Skip to content

Instantly share code, notes, and snippets.

View cmj's full-sized avatar
💭
📠

cmj cmj

💭
📠
View GitHub Profile
@cmj
cmj / portland-max.csv
Last active July 19, 2024 17:03
Portland - Days above 80, 90, and 100 degrees per year.
Year 80 90 100
1938 65 11 2
1939 60 17 2
1940 64 12 0
1941 42 11 5
1942 44 15 3
1943 51 8 0
1944 52 13 2
1945 59 12 1
1946 45 9 1
@cmj
cmj / max-temp-streaks.md
Last active July 17, 2024 14:32
Find longest streak of days 80° or above at SeaTac, 90° days at PDX
@cmj
cmj / twitter-graph.sh
Last active July 16, 2024 06:23
Graph Twitter user activity.
#!/bin/bash
# pip install pysparklines
cols=$(tput cols)
d0=$(date -Is -d '-1 day')
d1=$(date -Is)
clear
echo -e "\n@elonmusk combined twitter activity (likes+tweets) every 5min\n"
@cmj
cmj / test.md
Last active July 15, 2024 10:12
Examples on subtracting number from previous line.

Input file:

$ tail stats.dat
60316
60316
60316
60316
60316
60316
60318
@cmj
cmj / twstats.sh
Last active July 4, 2024 18:13
Grab Twitter user stats
#!/bin/bash
# grab the stats from a twitter user
# requires account, 2 parameters from header
# output:
# 20240704-110910 tweets: 46561 friends: 650 followers: 188667122 likes: 58781
x_csrf_token=''
auth_token=''
####
@cmj
cmj / koin.sh
Last active June 25, 2024 14:19
Create KOIN webcam montage via new Youtube sources
#!/bin/bash
# Create KOIN webcam montage via new Youtube sources
# * Requires Youtube API key
# livestream url: https://youtube.com/@KOINLOCAL6/streams
# channelId: UCXN7rPhZK6Rp8lMhvpSri_Q
# image url: https://i.ytimg.com/vi/wb5uv4SYHe0/maxresdefault.jpg
# old: https://media.psg.nexstardigital.net/koin/weather/cameras/Vancouver-Waterfront.jpg
# filter: grep -Ev 'Kalama|Evergreen'
key=""
@cmj
cmj / 1.md
Last active June 23, 2024 09:17
Twitter API back on for the week of ~June 12-21 2024

Most endpoints enabled on or around June 12th 2024:

  • Directly a result of Twitter disabling 'likes' features, they seemed to munge access controls.
  • For ~48 hours after June 13th, Twitter, still had favoritors/favorites v1.1 endpoints (all user's likes enabled, hidden or otherwise) up after disabling graphql endpoints (not shown).
  • All timelines were visible for a week, some didn't need x-guest-token for a day or two.
  • All old Nitter instances were working as a result of enabled timeline endpoints.

Graphql

old web new web tweetdeck preview android real account cookie
@cmj
cmj / tweet_by_id.sh
Last active June 21, 2024 13:27
Print tweet by id
#!/bin/bash
# ./tweet_by_id 1803601168763068837 (or full URL)
# -r option for json dump
input=$1
pretty=(jq -r '.data.tweetResult.result | "[\(.legacy.created_at | strptime("%a %b %d %H:%M:%S +0000 %Y") | mktime - (now | gmtime | mktime - (now | trunc)) | strflocaltime("%a %d %b %T %Z %Y"))] @\(.core.user_results.result.legacy.screen_name) (\(.core.user_results.result.legacy.name))\(if(.core.user_results.result.legacy.verified_type == "Business") then "【𝗚】: " elif(.core.user_results.result.is_blue_verified == true) then "【𝗕】: " else ": " end)\(.legacy.full_text | gsub(" ";" ")) | ↳ \(.legacy.reply_count | tostring | [while(length>0; .[:-3]) | .[-3:]] | reverse | join(",")) ⇅ \(.legacy.retweet_count | tostring | [while(length>0; .[:-3]) | .[-3:]] | reverse | join(",")) ♥ \(.legacy.favorite_count | tostring | [while(length>0; .[:-3]) | .[-3:]] | reverse| join(",")) 🡕 \(if(.views.count) then "\(.views.count | tostring | [while(length>0; .[:-3]) | .[-3:]] | reverse | join(","))" else "" end) | \(.source | gsub
@cmj
cmj / slurp_timeline.sh
Last active June 19, 2024 12:21
Twitter timelines without account
#!/bin/bash
# 2024-06-15 - Old Twitter api endpoints are up again.
# 2024-06-18 - Old Twitter api with guest token access are open (no account needed)
user=$1
if [ -z $user ]; then echo "$0 username"; exit; fi
count=5