Skip to content

Instantly share code, notes, and snippets.

View reikoNeko's full-sized avatar

Rachel Rawlings reikoNeko

View GitHub Profile
@reikoNeko
reikoNeko / gist:6a0600b3769d21a55cf2321f2a76651a
Created November 25, 2017 19:09
Flexible icinga DB performace data
def build_dict(seq, key):
return dict((d[key], dict(d)) for (_, d) in enumerate(seq))
i2stat = build_dict(raw["results"], 'name')
rate = {'IdoMysqlConnection': "idomysqlconnection_ido-mysql_queries_1min",
'IdoPgsqlConnection': "idomysqlconnection_ido-pgsql_queries_1min"}
print( set(i2stat.keys()) )
def escape(seq):
jumps = 0
pos = 0
while True:
try:
offset = seq[pos]
seq[pos] +=1
pos += offset
jumps +=1
def cryptogram(plaintext):
from random import shuffle
# create cryptogram cypher. You can't shuffle strings, so lists it is.
alpha = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
beta = alpha[:]
shuffle(beta)
cmap = dict(zip(alpha,beta))
# Map the received string to a cryptogram. Note we're not cleaning any input.
cryptext = [ cmap[c] if c in alpha else c for c in plaintext.upper()]
return ''.join(cryptext)
@reikoNeko
reikoNeko / massrenumber.sh
Created March 27, 2018 19:02
Renumber a batch of users' uids and gids, and fix file ownerships
#!/bin/bash
while IFS="," read -r name olduid oldgid newuid newgid
do
/usr/sbin/groupmod $name -g $newgid
/usr/sbin/usermod $name -u $newuid -g $newgid
/bin/chown --changes --silent --no-dereference --recursive \
--from=:$oldgid :$name /home/$name
done << END
tinker,8001,8001,701,701
sleep $((`date -d 2115 +%s` - `date +%s`)) && echo 'dowatchalike'
@reikoNeko
reikoNeko / gist:236023a7c2d7f160ef6c0170306319d0
Last active August 21, 2019 14:45
base64 decode ALL the things
Just in case you thought that CTF skills aren't useful in the real world,
the WPRB stream changed recently, breaking my saved bookmark in Rhythmbox.
On the station's web page, there was a popup player, but not a direct URL
for desktop players anymore. What's a Linux geek to do?
view-source:http://wprb.com/popup-player/
Where we find the configuration string
P3jPLAYLISTS.inline_0 = [
@reikoNeko
reikoNeko / hexstring.py
Created August 21, 2019 17:44
Assemble a human readable string from hexadecimal ascii
def hexstring(s):
return [ chr(int(x,16))for x in map(''.join, zip(*[iter(s)]*2)) ]
dmprg = ''.join(hexstring("7777772e796f75747562652e636f6d2f77617463683f763d5a79614b336a6f34536c34"))
@reikoNeko
reikoNeko / README.md
Last active December 2, 2019 01:22
AoC2019_01
import networkx as nx
universe = nx.DiGraph()
for line in progdata:
# use elements in list directly, rather than placeholders
universe.add_edge(*line.split(')') )
paths = dict(nx.all_pairs_shortest_path_length(universe))
center = list(nx.topological_sort(universe))[0]
print(center)
@reikoNeko
reikoNeko / build_capteha_images.md
Last active December 16, 2019 14:38
We need moar candy canes!?

Need more images from the Frido Sleigh CAPTEHA? Just want to test your training and categorization?

  • Open the site in a Chrome browser and open the developer tools
  • Log all the images through multiple runs of the CAPTEHA
  • Capture images into a .har archive -- It's just json, and the request strings include the full image in base64 mode.
  • Run the attached script to convert the images from the .har file to .png

Then run Chris Davis's scripts from https://github.com/chrisjd20/img_rec_tf_ml_demo to categorize your images!