Skip to content

Instantly share code, notes, and snippets.

@magnetikonline
magnetikonline / README.md
Last active February 18, 2025 08:11
Setting Nginx FastCGI response buffer sizes.
@bradmontgomery
bradmontgomery / shell.sh
Created February 9, 2014 05:22
Playing with `jq`, using the Albums api for a Facebook page. This is loosely based on the tutorial at: http://stedolan.github.io/jq/tutorial/
# pretty-print a JSON result
curl 'https://graph.facebook.com/memphispython/albums/' | jq '.'
# grab the data list
curl 'https://graph.facebook.com/memphispython/albums/' | jq '.data'
# Get *just* the first album
curl 'https://graph.facebook.com/memphispython/albums/' | jq '.data[0]'
# Narrow that first entry to some specific data
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active April 10, 2025 16:31
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@kbastani
kbastani / CalendarDay.cql
Last active July 14, 2020 20:36
This gist is a Neo4j Cypher query for merging a calendar graph for a specific year. This query has 4 levels of indexes, consisting of year, month, day, hour.
// Enter the day you would like to create
WITH { day: 18, month: 1, year: 2014 } as dayMap
// Merge hours in a day
MERGE (thisDay:Day { day: dayMap.day, month: dayMap.month, year: dayMap.year })
MERGE (firstHour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: 1 })
CREATE (thisDay)-[:FIRST]->(firstHour)
FOREACH (i IN tail(range(1, 24)) |
MERGE (thishour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: i })
MERGE (lasthour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: i - 1 })
@feulf
feulf / gist:8408501
Created January 13, 2014 21:27
tmux configuration
# Mouse support
setw -g mode-mouse on
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
set -g mouse-resize-pane on
set -g mouse-select-window on
# tmux vi mode
setw -g mode-keys vi

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@dragonmantank
dragonmantank / gist:6723460
Last active January 21, 2016 17:39
Reset Apache httpd to run as the vagrant user
exec { "change_httpd_user":
command => "sed -i 's/www-data/vagrant/g' /etc/apache2/envvars",
onlyif => "/bin/grep -q 'www-data' '/etc/apache2/envvars'",
notify => Service['apache2'],
require => Package['apache2'],
}
file { "/var/lock/apache2":
ensure => "directory",
owner => "vagrant",
@ewingd
ewingd / facepalm_for_loop.php
Last active December 21, 2015 21:08
facepalm for loop
<?php
// Before (this was repeated 3 times in one script, copy and pasted exactly...)
for($i=0,$btotal=0,$total=0,$page=1;$lclass=$row['class'],$lwhse=$row['whse'],$row=mysql_fetch_array($res);$i++,$total+=$row['cost'],$btotal+=$row['cost'],$gtotal+=$row['cost']) {
// ...snip.. 35 lines of echo statements dumping HTML
}
// Removing all the unused variables reduced it down to:
for ($i = 0; $row = mysql_fetch_array($res); $i++) {
// Same 35 lines of echo statements dumping HTML
@briandailey
briandailey / .bashrc
Created June 25, 2013 13:57
phpargs function - add to bashrc
function phpargs() {
curl -s http://us3.php.net/$1 | \
sed -n '/<div class="methodsynopsis dc-description">/,/<\/div>/p' | \
sed 's/<[^>]*>//g' | tr -d "\n"
echo
}
@13rac1
13rac1 / ansible-create-user-with-password
Created March 18, 2013 22:18
Create a user in an Ansible playbook with a set, but unknown password so the account is not locked. Makes it possible to log on the account with a public key. This example requires mkpasswd, but that can be replaced with any other password generator.
---
- hosts: all
gather_facts: yes
##
# Create the password then create the user
#
- name: Users | Generate password for new user
shell: makepasswd --chars=20
register: user_password