Skip to content

Instantly share code, notes, and snippets.

View thomasbrueggemann's full-sized avatar
👨‍💻

Thomas Brüggemann thomasbrueggemann

👨‍💻
View GitHub Profile
@hubgit
hubgit / xhr-binary.js
Created December 15, 2010 17:09
Binary file XHR getting and sending that works in Chrome 9 and Firefox
// https://developer.mozilla.org/en/using_xmlhttprequest
// http://web.archive.org/web/20071103070418/http://mgran.blogspot.com/2006/08/downloading-binary-streams-with.html
function getBinary(file){
var xhr = new XMLHttpRequest();
xhr.open("GET", file, false);
xhr.overrideMimeType("text/plain; charset=x-user-defined");
xhr.send(null);
return xhr.responseText;
}
#import "EGOCache.h"
@interface EGOCache (NSArray)
- (void)setArray:(NSArray*)array forKey:(NSString*)key;
- (void)setArray:(NSArray*)array forKey:(NSString*)key withTimeoutInterval:(NSTimeInterval)timeoutInterval;
- (NSArray*)arrayForKey:(NSString*)key;
@end
@jawnb
jawnb / populate_dns.py
Created August 12, 2011 03:35
Script to populate route53 DNS records from ec2 instance id and instance names.
#!/usr/bin/env python
import boto
from boto.route53.record import ResourceRecordSets
import logging
conn = boto.connect_ec2()
DNS_EXCLUSION_TAG = 'ExcludeFromDNS' # If this tag exists on an instance, no DNS values will be populated
DNS_TAGS = ['ShortName', 'Name'] # This is the list of instance tags we want to populate DNS entries from
DNS_SUFFIX = 'YOUR_SUBDOMAIN_HERE' # Suffix under which to create DNS records
ROUTE53_ZONE_ID = 'YOUR_ZONE_ID_HERE' # The zone id from route53 of the zone we will be adding these entries under
@usagi
usagi / boost_geometry_index_rtree.cpp
Created August 18, 2011 11:11
R-Tree sample using boost::geometry::index::rtree
#include <boost/geometry.hpp>
#include <boost/geometry/extensions/index/rtree/rtree.hpp>
#include <random>
#include <iostream>
#include <exception>
int main() try{
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@alotaiba
alotaiba / google_speech2text.md
Created February 3, 2012 13:20
Google Speech To Text API

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

@oodavid
oodavid / README.md
Last active June 12, 2024 00:28 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@spf13
spf13 / mongoHadoopInstall.sh
Created February 22, 2012 22:02
MongoHadoop Install
hadoop_version='0.23'
hadoop_path="/usr/local/Cellar/hadoop/$hadoop_version.0/libexec/lib"
git clone git://github.com/mongodb/mongo-hadoop.git
cd mongo-hadoop
sed -i '' "s/default/$hadoop_version/g" build.sbt
cd streaming
./build.sh
ln -s ~/.ivy2/cache/org.mongodb/mongo-java-driver/jars/mongo-java-driver-2.7.3.jar .
@fermion
fermion / apns.py
Created March 2, 2012 12:35 — forked from scotttam/apns.py
Sends an Apple Push Notification with Python
import socket, ssl, json, struct
import binascii
# device token returned when the iPhone application
# registers to receive alerts
deviceToken = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62'
thePayLoad = {
'aps': {
'alert':'Oh no! Server\'s Down!',
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->