Skip to content

Instantly share code, notes, and snippets.

@bps
bps / oops.c
Created October 11, 2016 17:13 — forked from davepeck/oops.c
iOS 7.0.6 "Security Content"
static OSStatus
SSLVerifySignedServerKeyExchange(SSLContext *ctx, bool isRsa, SSLBuffer signedParams,
uint8_t *signature, UInt16 signatureLen)
{
OSStatus err;
SSLBuffer hashOut, hashCtx, clientRandom, serverRandom;
uint8_t hashes[SSL_SHA1_DIGEST_LEN + SSL_MD5_DIGEST_LEN];
SSLBuffer signedHashes;
uint8_t *dataToSign;
size_t dataToSignLen;
@bps
bps / gist:d81851455b00e6631d8c
Created November 4, 2014 20:07
Normalize review dates
// Normalize review dates to the template project's date iff the project's review interval is the same as the template's. This is useful when you e.g. want to review most projects all at once every two weeks.
var template_project_name = 'Miscellaneous';
var ofocus = Application('OmniFocus');
var projects = ofocus.defaultDocument.projects;
var misc = projects.whose({name:template_project_name})[0];
var misc_review_interval = misc.reviewInterval();
var misc_next_review_date = misc.nextReviewDate();
### Keybase proof
I hereby claim:
* I am bps on github.
* I am bps (https://keybase.io/bps) on keybase.
* I have a public key whose fingerprint is A00D D4ED 5241 E99D ABC0 DAAA BCCB B6E9 143C 3452
To claim this, I am signing this object:
@bps
bps / private.xml
Created April 9, 2014 16:00
Fix modifier keys on MS Sculpt Ergonomic keyboard
<?xml version="1.0"?>
<root>
<!--
I found that remapping Cmd and Alt via the Keyboard prefs didn't
properly remap right Alt, so we'll do it here. Also map the
application key to right Alt.
-->
<devicevendordef>
<vendorname>MICROSOFT</vendorname>
<vendorid>0x045e</vendorid>
@bps
bps / scons.vim
Created November 4, 2011 18:59
Vim Scons command
function! s:Scons()
if !executable("scons")
echohl Error
echo "No scons executable."
echohl None
return -1
endif
let sconstruct = findfile("SConstruct", ".;")
if len(sconstruct)
exec "cd" fnameescape(fnamemodify(sconstruct, ':h'))
@bps
bps / git_ps1.sh
Created March 23, 2011 14:29
Sometimes __git_ps1 takes too long. This disables it when we ^C.
# via https://gist.github.com/623371
if [[ $(declare -f __git_ps1) ]]; then
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
git_ps1_disable ()
{
_skip_git_ps1=1
@bps
bps / sms_backup.sh
Created January 6, 2011 20:28
Script to back up your iPhone SMS from the iTunes database. Run it after you sync.
#!/bin/bash
set -e
BACKUP_DIR="${HOME}/Documents/Backup pile/SMS backup"
BACKUP_FILE="sms_backup.txt"
mkdir -p "${BACKUP_DIR}"
cd "${BACKUP_DIR}"
device_udid="put yours here"
@bps
bps / gist:338298
Created March 19, 2010 23:05
Rakefile to deploy dotfiles
require 'rake'
require 'digest'
begin
require 'grit'
rescue
end
$home = ENV['HOME']
raise "#{$home} is not a directory" if not File.directory? $home
@bps
bps / comm
Created February 9, 2010 16:00
screenrc for IRC and mail that uses newer screen features.
# Get HOL screen from http://git.savannah.gnu.org/gitweb/?p=screen.git
# 4.1.0 has vertical splitting and support for layouts, but has been cooking
# since at least early 2007. See
# http://lists.gnu.org/archive/html/screen-users/2007-02/msg00000.html for
# documentation on the new features, as they're not in the man page yet.
# Build it with "cd src && autoreconf -iv && ./configure --prefix=whatever &&
# make install"
# Communication layout, use a 160x50ish term
source ${HOME}/.screenrc
@bps
bps / pre-commit
Created February 1, 2010 16:28
A git pre-commit hook to stop you from committing scratch code.
#!/bin/sh
# A hook to abort a commit if your diff adds XXX or FIXME.
# Set this config variable if you want to allow it anyway.
allowfixmes=$(git config hooks.allowfixmes)
disallow_list="XXX FIXME"
if [ "$allowfixmes" != "true" ]
then
for disallow in $disallow_list