Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# nginx-installer:
# Install nginx.
#
# Forked from -- Author : Scott Barr
#
# $Id:$
set -e
@adamamyl
adamamyl / gist:4346500
Created December 20, 2012 16:32
rsync useful dirs from Mac ('hokey') -> removable disk
root@hokey:/# for D in `ls -lha | awk '/^d/ {print $NF}' | egrep -v '^(.Spotlight-V100|.Trashes|Volumes|dev)' | tail -n +3`; do echo "--------- Looking at ${D} -------"; rsync -vua /${D}/ /Volumes/Hokey-Backup/hokey-system/${D}/; done
# yes I could use awk instead of egrep.
# I prefer for() over while() for some reason.
@adamamyl
adamamyl / gist:4556825
Created January 17, 2013 15:38
nginx + php-fpm + SSL
server {
server_name rewiredreality.co.uk;
root "/data/vhosts/rewiredreality.co.uk/current/html";
listen 188.246.207.224:443 ssl;
ssl on;
ssl_certificate /data/vhosts/rewiredreality.co.uk/rewiredreality-deployment/ssl-certs/rewiredreality.co.uk-crt;
ssl_certificate_key /data/vhosts/rewiredreality.co.uk/rewiredreality-deployment/ssl-certs/rewiredreality.co.uk-key;
ssl_client_certificate /data/vhosts/rewiredreality.co.uk/rewiredreality-deployment/ssl-certs/GandiStandardSSLCA.crt;
@adamamyl
adamamyl / adam-opendata-guides
Created January 29, 2013 18:05
Adam brain-farts on "rules" for data
"it" means datasource(s)
1. is it accessible, without registration, academic credentials or not? what are the requirements, how long does it take
2. what are the licensing arrangements/terms
3. is this a restricted dataset? does it need to be stored/processed in line with iso 27001 [ http://en.wikipedia.org/wiki/ISO/IEC_27001 ] or special rules?
4. is re-use permitted? even commercial? (and subsidiary)
@adamamyl
adamamyl / README
Last active December 12, 2015 08:48 — forked from nertzy/README
These two files should help you to import passwords from mac OS X keychains to 1password.
Assumptions:
1) You have some experience with scripting/are a power-user. These scripts worked for me
but they haven't been extensively tested and if they don't work, you're on your own!
Please read this whole document before starting this process. If any of it seems
incomprehensible/frightening/over your head please do not use these scripts. You will
probably do something Very Bad and I wouldn't want that.
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they
After spending the better part of the month implementing date support
in RethinkDB, Mike Lucy sent the team the following e-mail. It would
have been funny, if it didn't cause thousands of programmers so much
pain. Read it, laugh, and weep!
-----
So, it turns out that we're only going to support dates between the
year 1400 and the year 10000 (inclusive), because that's what boost
supports.
require 'octokit'
require 'csv'
require 'date'
# Github credentials to access your private project
USERNAME="USER_NAME"
PASSWORD="SEKRIT"
# Project you want to export issues from
USER="REPO_OWNER"
PROJECT="REPO_NAME"
@adamamyl
adamamyl / rename-list
Created October 9, 2013 22:44
Script to rename a Mailman list
#!/bin/sh
#
# rename-list:
# rename lists
#
# Copyright (c) 2010 Adam McGreggor. All rights reserved.
# Email: adam@amyl.org.uk; WWW: http://blog.amyl.org.uk
#
# $Id: rename-list 260 2010-10-18 11:57:34Z adam $
#
@adamamyl
adamamyl / gist:7418434
Created November 11, 2013 18:59
./ appatently
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<title>The Birth of a Police State: UK Police to be Granted Sweeping New Powers | Scriptonite Daily</title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="http://www.scriptonitedaily.com/xmlrpc.php" />
<link rel="alternate" type="application/rss+xml" title="Scriptonite Daily &raquo; Feed" href="http://www.scriptonitedaily.com/feed/" />
<link rel="alternate" type="application/rss+xml" title="Scriptonite Daily &raquo; Comments Feed" href="http://www.scriptonitedaily.com/comments/feed/" />
#!/bin/bash
if [ -z "$1" ]; then
echo "";echo "[i] Usage: `basename $0` http://www.slideshare.net/link_with_presentation";echo "";exit
fi
presentation=`curl -s --user-agent 'Mozilla/5.0' "$1" | tr '"' "\n" | egrep -m 1 -e "static\.slidesharecdn\.com\/swf\/ssplayer2\.swf\?doc=(.*?)\{rel}{startSlide}" | cut -d '{' -f 1 | cut -d '=' -f 2`
pages=`curl -s --user-agent 'Mozilla/5.0' "$1" | grep -m 1 "slideshare_object" | sed 's/.*total_slides":\([^,]*\).*/\1/'`
version=`curl -s --user-agent 'Mozilla/5.0' "$1" | grep -m 1 "slideshare_object" | sed 's/.*version_no":"\([^""]*\).*/\1/'`
workdir=~/tmp/${RANDOM}${RANDOM}