Skip to content

Instantly share code, notes, and snippets.

@osdouglas
osdouglas / install_dotfiles.sh
Last active November 11, 2021 08:09
Install my dotfiles
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
git clone --bare git@github.com:osdouglas/.dotfiles.git $HOME/.dotfiles
dotfiles checkout
dotfiles config status.showUntrackedFiles no
for idx = 1, 5 do repeat
print(1)
print(2)
print(3)
do break end -- goes to next iteration of for
print(4)
print(5)
until true end
#import <CommonCrypto/CommonDigest.h>
@interface NSString (MD5)
- (NSString *)MD5String;
@end
@implementation NSString (MD5)
@osdouglas
osdouglas / sha1.m
Created October 20, 2014 16:28
SHA1 in ObjC
#include <CommonCrypto/CommonDigest.h>
unsigned char digest[CC_SHA1_DIGEST_LENGTH];
NSData *stringBytes = [someString dataUsingEncoding: NSUTF8StringEncoding]; /* or some other encoding */
if (CC_SHA1([stringBytes bytes], [stringBytes length], digest)) {
/* SHA-1 hash has been calculated and stored in 'digest'. */
...
}
@osdouglas
osdouglas / tshark
Created October 15, 2014 01:54
tshark in human readable from tcp dump
tshark -r <file> -O nfs -P
@osdouglas
osdouglas / machinedep.c
Created October 14, 2014 22:44
Testing unions
#include <stdio.h>
typedef union
{
short s;
char c;
}
sc;
int main( void )
{
sc u;
@osdouglas
osdouglas / fixii4.sh
Created October 7, 2014 23:41
Run on iPhone with JB to fix non 64bit Cydia apps that give "Illegal Instruction: 4" error
#/usr/bin/env bash
path="$( which $1 )"
echo $1 path is $path
sed -i'' 's/\x00\x30\x93\xe4/\x00\x30\x93\xe5/g;s/\x00\x30\xd3\xe4/\x00\x30\xd3\xe5/g;' $path
ldid -s $path