Skip to content

Instantly share code, notes, and snippets.

@baderj
baderj / find_seed.c
Last active May 26, 2017
find ramnit seed
View find_seed.c
#include <stdio.h>
#include <string.h>
unsigned long int rand_int_modulus(unsigned long int *ix, unsigned long int modulus) {
unsigned long int k1;
k1 = *ix / 127773;
*ix = 16807 * (*ix - k1 * 127773) - k1 * 2836;
return *ix % modulus;
}
View gist:a407613245f1c74022e8
import argparse
"""
Shiotob DGA
Generates domains for the Shiotob malware
- top level domains alternate between '.net' and '.com'
- domains are between 14 and 19 characters long
- domains consist of all letters and digits 123945
View gist:ff8e67865f11948a4f1a
wtipubctwiekhir.net
rwmu35avqo12tqc.com
rskb5bsfhm2fk5h.net
rbp9pprrxgflut9.com
zzxeyzgy45yy2a.net
e3oa4wglvd21xa.com
mqmq1hvmtxzjv.net
pd4o4wu24vimn.com
tlmrzvpbpsqsb.net
pbmnz59uzndpo.com
@baderj
baderj / garmin_ant_demo.py
Last active Nov 15, 2020
Script to illustrate heart rate capturing with Ant+, see blog post at http://www.johannesbader.ch/2014/06/track-your-heartrate-on-raspberry-pi-with-ant
View garmin_ant_demo.py
"""
Code based on:
https://github.com/mvillalba/python-ant/blob/develop/demos/ant.core/03-basicchannel.py
in the python-ant repository and
https://github.com/tomwardill/developerhealth
by Tom Wardill
"""
import sys
import time
from ant.core import driver, node, event, message, log
View xbmc_missing_artwork.py
import argparse
import sqlite3 as lite
import os
from collections import defaultdict
def _open_db(db):
try:
con = lite.connect(db)
cur = con.cursor()
return (cur,con)
View twitch_live_url.py
import requests
import json
import re
import argparse
import random
import m3u8
USHER_API = 'http://usher.twitch.tv/api/channel/hls/{channel}.m3u8?player=twitchweb' +\
'&token={token}&sig={sig}&$allow_audio_only=true&allow_source=true' + \
'&type=any&p={random}'
@baderj
baderj / twitch_past_broadcast_downloader.py
Last active May 31, 2021
script to download past broadcasts from twitch.tv
View twitch_past_broadcast_downloader.py
import requests
import sys
import json
import re
import os
import string
import argparse
BASE_URL = 'https://api.twitch.tv'
View missing_or_duplicate_movies.py
import argparse
import sqlite3 as lite
import os
def _open_db(db):
try:
con = lite.connect(db)
cur = con.cursor()
return (cur,con)
except lite.Error as e:
@baderj
baderj / twitchtv_viewer_rating.py
Last active Feb 15, 2016
poll the viewer ratings of a twitch channel using their API
View twitchtv_viewer_rating.py
import requests
import json
from datetime import datetime, timedelta
import time
import logging
import argparse
BASE_URL = 'https://api.twitch.tv/kraken/'
CLIENTID = '<add your API key here>'
@baderj
baderj / gist:7887807
Created Dec 10, 2013
Wordpress filter to highlight the menu item labeled "blog" if not on static pages. Add the code to functions.php
View gist:7887807
/* ------------------------------------------------------------------------ */
/* highlight the menu item labeled "blog" if not on static pages */
function add_custom_class($classes=array(), $menu_item=false) {
if ( !is_page() && 'Blog' == $menu_item->title && ! in_array( 'current-menu-item', $classes ) ) {
$classes[] = 'current-menu-item';
}
return $classes;
}
add_filter('nav_menu_css_class', 'add_custom_class', 100, 2);