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/25 19:30] – neutronscott | c:twitter.awk [2023/11/04 22:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Twitter.awk ====== | ====== Twitter.awk ====== | ||
- | [[http:// | + | [[http:// |
- | ===== Programming it ===== | + | ===== Challenges |
- | The latest challenge was messing with unicode/ | + | Starting from the beginning, and ending at the latest.. |
- | JSON will express this euro as \u20ac, I have to convert | + | ==== JSON ==== |
+ | awk doesn' | ||
- | I think it's good now. I'd still like to re-do the JSON parser. It goes char-by-char while somewhat remembering the state. It does it this way because | + | ==== 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 | ||
+ | |||
+ | 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 ==== | ==== HMAC-SHA1 ==== | ||
Line 16: | Line 23: | ||
IT WORKS! It's not for hashing a ton of files, just for OAuth header so speed is like... pfft whatever. | IT WORKS! It's not for hashing a ton of files, just for OAuth header so speed is like... pfft whatever. | ||
- | View that alone: http://san.aq/sha1 | + | It was mostly creating functions |
+ | Then a quick base64(), which wasn't hard to debug. I just was missing ' | ||
+ | |||
===== Source ===== | ===== Source ===== | ||
- | The code is viewable [[http://scottn.us/code/view.php? | + | Decided to start using my github account and have been pushing the code to: http://github.com/neutronscott/Twitter.awk |
c/twitter.awk.1311622253.txt.gz · Last modified: 2023/11/04 22:29 (external edit)