Skip to content

Instantly share code, notes, and snippets.

@ifnull
ifnull / simple-apache-conf-generator.sh
Created November 17, 2013 22:46
Generate Apache HTTPd configuration based on application and server needs.
#!/bin/bash
HTTPD_MEM=$(ps axo rss,cmd --sort -rss | grep httpd | head --lines 1 | awk '{print $1}');
HTTPD_MEM=$((HTTPD_MEM / 10**3));
service httpd stop;
MEM_TOTAL=$(free -m | head --lines 2 | tail --lines 1 | awk '{print $2}');
MEM_USED=$(free -m | head --lines 2 | tail --lines 1 | awk '{print $3}');
MEM_FREE_POOL="$((MEM_TOTAL - MEM_USED))";
HTTPD_POOL="$((MEM_FREE_POOL*80/100))";
MAX_CLIENT="$((HTTPD_POOL/HTTPD_MEM))";
MIN_SPARE_SRV="$((MAX_CLIENT*15/100))";
@ifnull
ifnull / local.xml
Created November 22, 2013 19:42
Magento Memcache configuration
<cache>
<backend>memcached</backend><!-- apc / memcached / empty=file -->
<memcached><!-- memcached cache backend related config -->
<servers><!-- any number of server nodes can be included -->
<server>
<host><![CDATA[127.0.0.1]]></host>
<port><![CDATA[11211]]></port>
<persistent><![CDATA[1]]></persistent>
</server>
</servers>
@ifnull
ifnull / temp.vcl
Created December 6, 2013 02:55
Varnish temp VCL
backend default {
.host = "127.0.0.1";
.port = "8080";
}
@ifnull
ifnull / gist:8814390
Created February 4, 2014 23:14
Download your Facebook "A look back" Video
window.location = JSON.parse(decodeURIComponent(document.getElementsByTagName("embed")[0].getAttribute('flashvars').split('&')[0].split('=')[1])).video_data[0].hd_src;
@ifnull
ifnull / fix-nike-plus.md
Last active May 8, 2018 19:11
How I fixed my Nike+ app.

You can't uninstall, you can't reset your profile and as long as your pin is valid on the Nike server it will continue to log your workouts to some diconnected account on their end. To fix this, you have to get your iPhone to invalidate your account.

  1. Install the trial version of Charles http://www.charlesproxy.com/download/

  2. Download the Charles certs and install them on your iPhone http://www.charlesproxy.com/ssl.zip

  3. Create a local map in Charles from https://nikeplus.nike.com/nikeplus/v1/services/device/get_pin_status.jsp to a local file with the following content.

@ifnull
ifnull / README.md
Last active November 22, 2022 21:46
Using TOR as a proxy for Python on OSX
@ifnull
ifnull / check-divisibility.py
Created February 24, 2014 07:20
Math: Check divisibility
#!/usr/bin/env python
import math, time
# 01. All whole numbers are multiples of 1
# 02. The last digit is 2, 4, 6, 8, 0
# 03. The digits add up to a multiple of 3
# 04. The last 2 digits are a multiple of 4
# 05. Last digit is either 5 or 0
# 06. Divisible by 2 and 3
@ifnull
ifnull / baby-stuff.md
Last active February 2, 2017 22:56
Baby Stuff
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:*"
],
"Resource": [
"arn:aws:iam::*",
@ifnull
ifnull / gist:9614867
Created March 18, 2014 06:57
PIN numbers sorted by probability.
1234
0000
1111
2580
1212
5555
2222
6969
7777
5683