Skip to content

Instantly share code, notes, and snippets.

View funkjedi's full-sized avatar

Tim Robertson funkjedi

View GitHub Profile
@seanhandley
seanhandley / docker-compose.yml
Last active April 9, 2024 04:05
How To Set Up Docker For Mac (Mojave) with Native NFS
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
@touhonoob
touhonoob / gs.nginx.conf
Created June 6, 2015 13:35
Nginx as Google Cloud Storage Cache
# Cache 10GB for 1 Month
proxy_cache_path /var/cache/nginx keys_zone=GS:10m inactive=720h max_size=10240m;
upstream gs {
server 'storage.googleapis.com:80';
keepalive 100;
}
server {
set $my_domain "yourdomain.com";
@xpol
xpol / build.sh
Created October 14, 2014 14:25
iOS build script
# Unlock keychain
security unlock-keychain -p jenkins /Users/jenkins/Library/Keychains/login.keychain
# Build and sign app
xcodebuild -configuration Distribution clean build
# Set variables
APP_PATH="$PWD/build/Distribution-iphoneos/iPadApp.app"
VERSION=`defaults read $APP_PATH/Info CFBundleShortVersionString`
REVISION=`defaults read $APP_PATH/Info CFBundleVersion`
@denji
denji / nginx-tuning.md
Last active May 3, 2024 03:57
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@joeriks
joeriks / get.cshtml
Created August 21, 2012 09:14
Simple razor api
@functions{
// URL : /macroScripts/api/order/get/{id} [GET]
protected override void InitializePage()
{
// UrlData[0] is the first url part after the path, in our case the {id}
var orderId = UrlData[0].AsInt();
Json.Write(WebApp.Db.SingleOrDefault<Order>(orderId),Response.Output);
}
}
@SiriusDely
SiriusDely / push_apns.php
Created May 2, 2012 00:23
Push Notification PHP Script - Apple iOS, Android C2DM, BlackBerry PPG
<?php
// Put your device token here (without spaces):
$deviceToken = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
// Put your private key's passphrase here:
$passphrase = 'xxxxxxx';
// Put your alert message here:
$message = 'A push notification has been sent!';
@AAS
AAS / gist:2036916
Created March 14, 2012 14:37
OS X 10.7 Lion Finder - Folders on top
Open Terminal.
Type this command:
cd /System/Library/CoreServices/Finder.app/Contents/Resources/English.lproj/
Now, the file we want to mess around is the InfoPlist.strings. But unfortunately, this file cannot be edited directly using text editor in Lion. But no worries. Run this command to make it editable.
sudo plutil -convert xml1 InfoPlist.strings
Now the file should be editable and readable. Use your favorite text editor and open InfoPlist.strings. I just used vim
sudo vim InfoPlist.strings
@funkjedi
funkjedi / gist:1248612
Created September 28, 2011 17:39
Reset file and directory permissions
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
@johngrimes
johngrimes / date.sql
Created May 21, 2010 07:03
MySQL Date Dimension Build Script
/* Adapted from Tom Cunningham's 'Data Warehousing with MySql' (www.meansandends.com/mysql-data-warehouse) */
###### small-numbers table
DROP TABLE IF EXISTS numbers_small;
CREATE TABLE numbers_small (number INT);
INSERT INTO numbers_small VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
###### main numbers table
DROP TABLE IF EXISTS numbers;
CREATE TABLE numbers (number BIGINT);