Skip to content

Instantly share code, notes, and snippets.


John B Nelson jbn

View GitHub Profile
import subprocess
import requests
from pyquery import PyQuery
import time
def send_to_pushover():"", data={
"token": "XXX",
"user": "XXX",
jbn /
Created Jul 7, 2021
How I rotate my AVI
import tweepy
import json
import time
import datetime
from calendar import monthrange
from PIL import Image, ImageEnhance
import pathlib
import pylunar
jbn /
Last active Oct 4, 2020
A shifted geometric distribution with p=0.75 via bit twiddling
# Came across the `randomLevel` function in
# which implements a geometric distribution with bit twiddling.
# Below is a pedagogical implementation.
import random
from collections import Counter
jbn / Dockerfile
Created Sep 25, 2020
An attempt to build akash from scratch and set up a validator
View Dockerfile
FROM golang:1.14.9-stretch
# See:
RUN cd $GOPATH/src && mkdir -p && \
cd && \
git clone && \
cd akash && \
MAINNET=true git checkout v0.8.1 && \
make deps-install && \
make install
jbn / python_help_evolution.txt
Created Jul 13, 2020
Diff of python --help over time
View python_help_evolution.txt
Python 2.7.10
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Options and arguments (and corresponding environment variables):
-B : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x
-c cmd : program passed in as string (terminates option list)
-d : debug output from parser; also PYTHONDEBUG=x
-E : ignore PYTHON* environment variables (such as PYTHONPATH)
-h : print this help message and exit (also --help)
import json
import pathlib
import tweepy
import pickle
from collections import defaultdict
import pandas as pd
from dateutil.parser import parse as parse_time
def load_api():
import numpy as np
n, syn, ack = 240, "SYN", "ACK"
k = n//4
idx = sorted(zip(np.random.randint(0, n, k), np.random.choice([syn, ack], k)))
corruption = []
for i in range(n):
while idx and idx[0][0] <= i:
import tweepy # pip install tweepy
import json
import time
from missing_builtins import chunker # pip install missingbuiltins
with open("twitter_creds.json") as fp: # Yours with the fields below
creds = json.load(fp)
auth = tweepy.OAuthHandler(creds['appKey'], creds['appSecret'])
auth.set_access_token(creds['userToken'], creds['userSecret'])
api = tweepy.API(auth)
sudo apt-get install jq # See:
take Virus # or, mkdir Virus && cd Virus
python -m venv env
source env/bin/activate
pip jmespath twarc #
twarc configure #
twarc filter "#TraceableMemeticVirus" | tee -a virus.jsonl | jq '. | {id: .id, who: .user.screen_name, what: .text}'