Skip to content

Instantly share code, notes, and snippets.

View benny-shotvibe's full-sized avatar

benny-shotvibe

View GitHub Profile
@benny-shotvibe
benny-shotvibe / nginx_patch.md
Last active November 8, 2015 16:58
Patched version of nginx

We are using a patched version of nginx that does not erase the "ETag" http header for gzipped responses.

See: https://forum.nginx.org/read.php?2,240120,240120#msg-240120

This is what was done:

To compile nginx, the PCRE library is needed. Here is how it was installed:

$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz

$ tar -zxvf pcre-8.37.tar.gz

@benny-shotvibe
benny-shotvibe / django_performance_measure.py
Created November 8, 2015 13:32
Django poor man's view performance measurement
# Make sure to set in settings.py:
# DEBUG = True
from django.db import connection
from django import db
import time
db.reset_queries()
start = time.time()
result = VIEW_FUNCTION_HERE(request) # !!!!! EDIT THIS LINE !!!!!
end = time.time()
@benny-shotvibe
benny-shotvibe / gist:1e0d745b7bc68a9c3256
Last active November 3, 2023 20:36
Android Save To Gallery
// This is an outdated way to do this...
// Inspired by:
// http://stackoverflow.com/questions/8560501/android-save-image-into-gallery/8722494#8722494
// https://gist.github.com/samkirton/0242ba81d7ca00b475b9
public static void saveImageToGallery(ContentResolver cr, String imagePath) {
String title = "Saved From Glance";
String description = title;
@benny-shotvibe
benny-shotvibe / disable-vnc.sh
Last active August 29, 2015 14:08
Mac OS X VNC
#!/bin/sh
# Source:
# http://apple.stackexchange.com/a/30239
# http://technotes.twosmallcoins.com/?p=279
/bin/echo -n 'Need sudo access, '
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -configure -access -off
@benny-shotvibe
benny-shotvibe / gist:9464113
Created March 10, 2014 12:22
PostgreSQL Backup and Restore

To backup:

$ sudo -u postgres -i
$ export DB_NAME="mydatabase"
$ pg_dump -Fc "$DB_NAME" > "$DB_NAME"-`date -u +%Y%m%d%H%M%S`.dump

To restore:

$ sudo -u postgres -i

$ export DB_NAME="mydatabase"

@benny-shotvibe
benny-shotvibe / gist:9151443
Created February 22, 2014 10:03
Certificate Authority Commands
@benny-shotvibe
benny-shotvibe / Jenkins.md
Last active August 29, 2023 14:55
Installing Jenkins from scratch

Installing Jenkins from scratch

This is how I install Jenkins on a bare system. I'm using Ubuntu 12.04 32bit

First Steps

System Config

Always good to update the system packages after a fresh install: