Skip to content

Instantly share code, notes, and snippets.

View concertman's full-sized avatar
:shipit:

Jarod McBride concertman

:shipit:
View GitHub Profile
@landonf
landonf / 0_completion_post.txt
Last active August 29, 2015 14:07
Data posted to Apple by Spotlight (Bulky JSON payloads have been reformatted for readability). Note the X-Apple-UserGuid -- this appears to remain constant across all requests.
POST /fb?key=andromeda HTTP/1.1
Host: api.smoot.apple.com
Content-Type: application/json
Accept-Charset: utf-8
Connection: keep-alive
X-Apple-ActionSignature: ArFF0Bupz4+n05DZ/5MjOYH6XbRrC98eRfE+8OzUT0wKAAABwAMAAAABAAABAO7FAuqnAwyvZFj4n1tcSQxl42hKlg/915t5zBgrff9a2axEBZXtPF2Tg0rdJIEJJ/r4sMinOShzj3lvY9LmX1ZS76JmJNM0WZLzpat3WBzTmsgwyWUGSwO1ZUCURtaYyd5GryXCOfKyC0EIy8g3ppLlRdg4NOfIH043t/x7dzXjSJnuFZxgjkNtXJjlZtpyhU/1aozZABRHLK6nnPu33ek59bQMDwtQGyPC/3+DBJeujZcVuZI6of22HaV2oVFLz3zXEfEAcfeL5WPLWinnmLN+RZIrONwRmy/64kYbrkDO3P00R96wW6LJBYe63d6vWCrXlWTQeL7DDtwaR29Q0lYAAAAQ7fKDT5fxlqnZiMWRl6sNlQAAAJ8BZJzusSpopU9YFrn8J9VG1D/Ve1QAAACGBQJ/jp+/zKfOoBgaJGgjxWW8VEHM8hOyIUG96CcnUgA2Aqfvvv9nzKjAU05WWJSzGq4jMw5xzBsDlj9oSpM9/8PEHAlDKz2v7hNR3TLlAkH/2GMJgF7ly7dnqPPG4fjEvoT7Pz/bEepVSsboPqm8ztaSvCYoC3xBbXEPPO5AjiH4jeDbKLI=
Accept: application/json
X-Apple-UserGuid: 267af341-df6c-4eed-5e78-a2b8a49a1d1f
User-Agent: (OS X 14A389) Spotlight/916
Content-Length: 5991
@klaas
klaas / StreamReader.swift
Last active May 21, 2017 14:51
Xcode 6.1 version of source for this SO answer http://stackoverflow.com/a/24648951/292145
import Foundation
class StreamReader {
let encoding : UInt
let chunkSize : Int
var atEof : Bool = false
var fileHandle : NSFileHandle!
let buffer : NSMutableData!
@carlosefonseca
carlosefonseca / sqlite2csv.sh
Created January 9, 2014 13:44
Exports all tables in a sqlite database to CSV.
#!/usr/bin/env bash
# obtains all data tables from database
TS=`sqlite3 $1 "SELECT tbl_name FROM sqlite_master WHERE type='table' and tbl_name not like 'sqlite_%';"`
# exports each table to csv
for T in $TS; do
sqlite3 $1 <<!
.headers on
server {
listen *:80 ;
server_name my.host.org;
location ~ ^/_aliases$ {
proxy_pass http://127.0.0.1:9200;
proxy_read_timeout 90;
}
location ~ ^/.*/_search$ {
proxy_pass http://127.0.0.1:9200;
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@markoa
markoa / deploy.rb
Created October 10, 2011 13:31
Ingredients to monitor Resque with God automatically via Capistrano (on Ubuntu)
namespace :deploy do
desc "Hot-reload God configuration for the Resque worker"
task :reload_god_config do
sudo "god stop resque"
sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}"
sudo "god start resque"
end
end
# append to the bottom:
@erichurst
erichurst / database.yml.example mysql2
Created May 9, 2011 02:58
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@jamalsa
jamalsa / repeated_permutation.py
Created March 31, 2011 02:23
This is simple python script to display all possible permutation from sequence of number with repeated element
'''
Problems: Given list of sequence number from 1 to n. Generate lists of all possible permutation with
repeated element. For example :
[1,2] => [1,1], [1,2], [2,1], [2,2]
[1,2,3] => [1,1,1], [1,1,2], [1,1,3], [1,2,1], [1,2,2], [1,3,3], [1,3,1], [1,3,2], [1,3,3],
[2,1,1], [2,1,2], [2,1,3], [2,2,1], [2,2,2], [2,3,3], [2,3,1], [2,3,2], [2,3,3],
[3,1,1], [3,1,2], [3,1,3], [3,2,1], [3,2,2], [3,3,3], [3,3,1], [3,3,2], [3,3,3],
'''
@theozaurus
theozaurus / gist:716974
Created November 26, 2010 17:17
foobar.conf
# Enable upload_progress module for easy cross browser progress bar support
# using only javascript client side
upload_progress foobar_uploads 1m;
server {
# We only need one server block to deal with HTTP and HTTPS
# avoids duplication
listen 80;
listen 443 default ssl;
@mikhailov
mikhailov / installation.sh
Created November 23, 2010 15:18
nginx+passenger (real production config)
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz