c:twitter.awk
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
c:twitter.awk [2011/07/24 17:53] – neutronscott | c:twitter.awk [2023/11/04 22:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Twitter.awk ====== | ====== Twitter.awk ====== | ||
- | The part that I' | + | [[http:// |
- | ====== source ====== | + | ===== Challenges |
- | The code is viewable [[http:// | + | Starting from the beginning, and ending at the latest.. |
+ | ==== JSON ==== | ||
+ | awk doesn' | ||
+ | |||
+ | ==== OAuth ==== | ||
+ | Twitter requires HMAC-SHA1. This isn't hard with a pipe to openssl and base64. | ||
+ | |||
+ | ==== Unicode ==== | ||
+ | This challenge was revisited a couple times. I now know what Unicode and UTF-8 actually are! :) ASCII is define as first 127 (bit 7 is 0) to keep backward compat with the way things were. If bit 7 is 1, it is UTF-8. UTF-8 is a variable byte-width character, and uses a bitmap to determine how many following bytes are used. For example the Euro currency symbol is U+20AC and once it is encoded it is " | ||
+ | |||
+ | JSON will express this Euro as \u20ac in a string. I first have to convert to UTF-8 to display to terminal. Then I have to URL encode it to re-send to Twitter. In awk, sprintf(" | ||
+ | |||
+ | ==== HMAC-SHA1 ==== | ||
+ | I wanted to drop dependancy on OpenSSL CLI, so I wrote HMAC-SHA1 routine in awk using binary strings. :) | ||
+ | |||
+ | IT WORKS! It's not for hashing a ton of files, just for OAuth header so speed is like... pfft whatever. | ||
+ | |||
+ | It was mostly creating functions that did binary operations using strings. Then a direct implement of the wikipedia pseudo-code, | ||
+ | |||
+ | Then a quick base64(), which wasn't hard to debug. I just was missing ' | ||
+ | |||
+ | ===== Source ===== | ||
+ | |||
+ | Decided to start using my github account and have been pushing the code to: http:// |
c/twitter.awk.1311530034.txt.gz · Last modified: 2023/11/04 22:29 (external edit)