Skip to content

Instantly share code, notes, and snippets.

@jlongman
jlongman / bug.m3u8
Last active June 14, 2017 20:45
m3u8 crafted bug superchunklist
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:10395
#EXTINF:1.0,
fake_10395.ts
#EXTINF:1.0,
fake_10396.ts
#EXTINF:1.0,
fake_10397.ts
@jlongman
jlongman / gist:e1557e478245212694a98bfbbfe2ddcf
Last active May 8, 2017 21:04
jq for selecting key and nested value
# sample data:
echo '{"count": {}, "block":
{
"67.215.237.26": {
"paths": {
"/js/compiled.js": 1,
"/css/global-compiled.css": 1,
"/js/pace.min.js": 1
},
"max_req_per_min": 1,
@jlongman
jlongman / lircrc
Created April 7, 2017 00:53
A sample lircrc for pausing a ChromeCast from IR using scripts from https://github.com/jlongman/chromecast-button
begin
remote = element
prog = irexec
button = KEY_PLAYPAUSE
config = /bin/sh /home/pi/chromecast-button/pause.sh
config = /bin/sh /home/pi/chromecast-button/play.sh
end
begin
remote = element
prog = irexec
@jlongman
jlongman / gencode.py
Created April 1, 2017 20:39
Generate all possibly combinations of lirc codes for hex style
count = 0
while (count < 0x10000):
formatted = format(count, '04X')
print " KEY_{0} 0x{0}".format(formatted)
count += 1
#!/bin/sh
# see lircd.conf here: https://gist.github.com/jlongman/a7a56241506681083d9b939828716dd6
irsend SEND_ONCE seiki KEY_TV
sleep 5
irsend SEND_ONCE seiki KEY_INPUT_SOURCE
irsend SEND_ONCE seiki KEY_UP
irsend SEND_ONCE seiki KEY_UP
irsend SEND_ONCE seiki KEY_UP
irsend SEND_ONCE seiki KEY_UP
irsend SEND_ONCE seiki KEY_OK
begin remote
name seiki
bits 16
flags SPACE_ENC|CONST_LENGTH
eps 30
aeps 100
header 9046 4428
one 596 1606
@jlongman
jlongman / oldblog.sh
Created February 12, 2017 18:18
My old blog xmlstarlet extraction method
xmlstarlet sel -N my=http://www.w3.org/1999/xhtml -t -c "my:html/my:body/my:div[@class='single-post']" -c "my:html/my:body/my:div/my:div/my:ol[@id='comments']" indexfbc5-4.html
@jlongman
jlongman / wayback-files.py
Created February 9, 2017 03:40
Mv similarly named files to a backup directory,
# usage: pipe an ls command with relevant files.
# e.g. 'ls indexea4f*.html| python wayback-files.py'
#
# assumption: your source pages are static and you don't care about the differences from different dates.
# my blog didn't tend to have blog entry edits
import sys
import os
lastname = ""
@jlongman
jlongman / bikeshare.js
Last active June 1, 2016 18:24
Create a static google map with nearby bixi - from atlasboard code
/**
* Job: staticmap
* Code fragment from bixi atlastboard
* Example Config:
* "mystaticmap": {
* "lat": 40.76727,
* "lon":-73.99392888,
* "city": "nyc"
* }
*
@jlongman
jlongman / ssh_publish.sh
Created May 25, 2015 14:31
publish ssh key to host
# there's a tool on Linux that does similar to this, not on FreeBSD
ssh_publish(){
host=$1
shift
ssh-keygen -R $host
cat ~/.ssh/id_dsa.pub | ssh -oStrictHostKeyChecking=no $host $@ "mkdir -p .ssh && cat >> .ssh/authorized_keys"
}