Skip to content

Instantly share code, notes, and snippets.

View justincase's full-sized avatar

Justin Case justincase

View GitHub Profile
@sawapi
sawapi / AppDelegate.swift
Last active October 25, 2023 09:26
[Swift] Push Notification
//
// AppDelegate.swift
// pushtest
//
// Created by sawapi on 2014/06/08.
// Copyright (c) 2014年 sawapi. All rights reserved.
//
// iOS8用
import UIKit
@ibussieres
ibussieres / upgrade_pg.sh
Last active May 26, 2021 04:29
Upgrade PostgreSQL 9.1 to 9.3 on Ubuntu 12.04
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3 -y
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
sudo su - postgres -c "service postgresql stop"
sudo su - postgres -c '/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"'
// level0 project main.go
package main
import (
"bytes"
"io/ioutil"
"log"
"math"
"os"
"reflect"
@kevinburke
kevinburke / haproxy.config
Created October 10, 2013 17:34
twilio haproxy config
# Twilio HTTP HAProxy Configuration
# Version: 0.1
global
daemon
log 127.0.0.1 local0 info
maxconn 60000
spread-checks 3
@rcrowley
rcrowley / grace.go
Last active March 1, 2023 16:06
Graceful stop in Go
package main
import (
"log"
"net"
"os"
"os/signal"
"sync"
"syscall"
"time"
@mikeyk
mikeyk / watch_wal-e.py
Created January 16, 2013 20:24
Watch_wal-e script
#! /usr/bin/env python
from boto.ses.connection import SESConnection
import os
import sys
import subprocess
import socket
TMPFILE = '/var/run/postgresql/last-wal-archive-error-file.tmp'
if __name__ == '__main__':
@dadoonet
dadoonet / backup.sh
Created December 26, 2012 14:50
Backup Elasticsearch node
# Script to be placed in elasticsearch/bin
# Launch it from elasticsearch dir
# bin/backup indexname
# We suppose that data are under elasticsearch/data
# It will create a backup file under elasticsearch/backup
if [ -z "$1" ]; then
INDEX_NAME="dummy"
else
INDEX_NAME=$1
@border
border / long_polling.go
Created September 25, 2012 09:58
long polling for golang
package main
import (
"container/list"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
@coffeesnake
coffeesnake / serve.py
Created July 11, 2012 21:19
quick'n'dirty multithreaded wsgiref sample
from wsgiref.simple_server import make_server, WSGIServer
from SocketServer import ThreadingMixIn
from time import sleep
def simple_app(env, start_response):
status = '200 OK'
headers = [('Content-type', 'text/plain')]
start_response(status, headers)
@icholy
icholy / htmlline.py
Created June 17, 2012 20:36
pygments html formatter with line wrapping
# -*- coding: utf-8 -*-
"""
pygments.formatters.htmlline
~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for HTML output which wraps each line in a span.
"""
__all__ = ['HtmlLineFormatter']