Backup of SQL Fiddle code for this StackOverflow answer: http://stackoverflow.com/a/10395492/1349518
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to install kf2 server under wine on ubuntu 14.04 (AWS micro instance) | |
# This script makes a mess, run it in a subdirectory to keep it contained | |
# Also run it on a server you don't care about or be sure you don't mind when it | |
# installs a bunch of random crap | |
# Install wine | |
if dpkg -l wine > /dev/null 2>/dev/null; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Search all varchar columns in an entire database for a specific value | |
-- DANGER: do not use on large databases. 10k rows **should** be fine, larger than that requires caution. | |
-- Run this script in a temp database. It needs access to the target database and information_schema to run. | |
-- Results will go into a temporary table called rset. Everything will be cleaned up once you disconnect. | |
-- BEGIN SCRIPT -- | |
-- Variables. Modify these, the rest of the script will do the work for you. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table bbc ( | |
region varchar(50) not null, | |
name varchar(50) not null primary key, | |
population integer | |
); | |
insert into bbc values ('Oceania', 'Australia', 20); | |
insert into bbc values ('Oceania', 'New Zealand', 4); | |
insert into bbc values ('Oceania', 'Solomon Islands', NULL); | |
insert into bbc values ('Asia', 'Japan', 50); |
These steps were run to set up the local network
sudo apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo bash -c "echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get -y install docker-engine
sudo docker run hello-world
sudo docker run -it ubuntu bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to leech videos from lca2013 | |
# Will not re-download stuff you already have | |
# | |
# Requires curl, sed and grep | |
# | |
# Yes, this parses HTML with regex. Deal with it. | |
# | |
# Known bugs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdlib> | |
using namespace std; | |
// Arbitrary precision c++ library | |
// compile with: | |
// gcc thisfile.c -lgmp -lgmpxx -o mybinary | |
#include <gmpxx.h> | |
int main(int argc, char **argv){ |
Docker is a useful abstraction for processes
- Web application server (django/rails/tomcat/...)
- Database
- Reverse HTTP proxy (nginx/apache)
... each in their own Docker container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$connstring = "host=localhost dbname=test user=dwurf password=<secret>"; | |
$conn = pg_connect($connstring); | |
$search = ($_GET['term']); | |
if (!$conn) { die('Could not connect: ' . pg_last_error ());} | |
else | |
{ | |
$sql = "SELECT name FROM users_table WHERE name ILIKE '%$search%' ORDER BY name ASC"; |
OlderNewer