Skip to content

Instantly share code, notes, and snippets.

@fay59
fay59 / Key code reader.
Created May 25, 2015 21:29
Key code reader
/*
* Based on keytable.c by Mauro Carvalho Chehab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@fay59
fay59 / words.txt
Created June 3, 2015 17:23
English words
This file has been truncated, but you can view the full file.
a
aah
aahed
aahing
aahs
aardvark
aardvarks
aardwolf
ab
abaci
@fay59
fay59 / icloud-album-download.sh
Last active September 16, 2024 09:58
Download entire iCloud shared albums
#!/bin/bash
# requires jq
# arg 1: iCloud web album URL
# arg 2: folder to download into (optional)
function curl_post_json {
curl -sH "Content-Type: application/json" -X POST -d "@-" "$@"
}
@fay59
fay59 / comments.lex
Created March 14, 2017 21:13
Tiny Flex lexer that skips C-style block comments
%option noyywrap
%x C_COMMENT
%%
"/*" { BEGIN(C_COMMENT); }
<C_COMMENT>"*/" { BEGIN(INITIAL); }
<C_COMMENT>. { }
<C_COMMENT>\n { }
@fay59
fay59 / PhotosGPX.scpt
Last active October 29, 2024 18:22
Set GPS coordinates of media items in Photos using GPX file
(*
To use:
1- Launch Photos
2- Select photos for which you want to set the GPS location based on a .gpx file
3- Adjust date/time of photos (if necessary)
4- Launch script, select GPX file, wait
*)
@fay59
fay59 / realism.py
Last active September 19, 2017 07:29
Solution to realism.py that uses z3
'''
Solution to the realism challenge from CSAW'17 Quals.
https://github.com/isislab/CSAW-CTF-2017-Quals/tree/master/rev/realism
'''
from z3 import *
s = Solver()
# This is a simplification of the array of bytes found at 0x7D90:
# 0xff => 1, 0x00 => 0; where 1 means "include this value in the psadbw sum"
fn digits_to_vec(digits: String) -> Vec<u32> {
let mut result = Vec::new();
for c in digits.chars() {
match c.to_digit(10) {
Some(v) => result.push(v),
None => {}
}
}
return result;
}
fn digits_to_vec(digits: String) -> Vec<u32> {
let mut result = Vec::new();
for c in digits.chars() {
match c.to_digit(10) {
Some(v) => result.push(v),
None => {}
}
}
return result;
}
@fay59
fay59 / deriv.swift
Last active December 29, 2017 00:19 — forked from jdh30/deriv.swift
Swift code to compute the nth derivative of x^x
precedencegroup ExponentPrecedence {
associativity: right
higherThan: MultiplicationPrecedence
}
infix operator **: ExponentPrecedence
fileprivate enum Expr: CustomStringConvertible {
case Int(n: Int)
indirect case Var(x: String)
@fay59
fay59 / dom_tree.py
Created May 19, 2018 06:42
Finding regions in Python
import networkx as nx
class DominatorTreeNode(object):
__slots__ = ("value", "depth", "parent", "children")
def __init__(self, value):
self.value = value
self.depth = None
self.parent = None