Solution moved to repository. Please see https://github.com/reikoNeko/Advent2019/blob/master/01_solution.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def escape(seq): | |
jumps = 0 | |
pos = 0 | |
while True: | |
try: | |
offset = seq[pos] | |
seq[pos] +=1 | |
pos += offset | |
jumps +=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sleep $((`date -d 2115 +%s` - `date +%s`)) && echo 'dowatchalike' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hexstring(s): | |
return [ chr(int(x,16))for x in map(''.join, zip(*[iter(s)]*2)) ] | |
dmprg = ''.join(hexstring("7777772e796f75747562652e636f6d2f77617463683f763d5a79614b336a6f34536c34")) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
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!