Skip to content

Instantly share code, notes, and snippets.

View sandys's full-sized avatar

Sandeep Srinivasa sandys

View GitHub Profile
@sandys
sandys / README.md
Created October 12, 2013 13:04 — forked from nikcub/README.md
@sandys
sandys / build.sbt
Created October 26, 2013 04:59 — forked from sam/build.sbt
name := "foo"
version := "1.0-SNAPSHOT"
scalaVersion := "2.10.3"
scalacOptions in ThisBuild ++= Seq(
"-language:_",
"-feature",
"-unchecked",
@sandys
sandys / build.scala
Created October 26, 2013 12:44
build.scala
import sbt._
import Keys._
import sbtassembly.Plugin._
//import AssemblyKeys._ // put this at the top of the file
import sbtassembly.Plugin.AssemblyKeys
import sbtassembly.Plugin.AssemblyKeys._
import sbtassembly.Plugin.assemblySettings
import sbtassembly.Plugin.MergeStrategy
@sandys
sandys / ec2-py.json
Last active December 28, 2015 20:39
ansible teardown problem
#This is the output of running ec2.py
{
"ec2": [
"54.201.98.213"
],
"i-8bcae5bf": [
"54.201.98.213"
],
"key_ansible-1": [
"54.201.98.213"
@sandys
sandys / gist:8300759
Created January 7, 2014 15:15
CDN header hacker news
As people mentioned this site is an exception to how to do things, in that PG actively does not care about search engine results. However, for the people who are interested, here's a few ways you can handle a situation like this.
1. If you add the "max-stale" header to your content you can tell your CDN to hold on to things longer in the event of an outage. What happens is that the CDN will look at the cache time you set and check in as normal when that expires, but if it gets back no response or a 503 code (server maintenance status code- if you work with CDNs this is your friend!) it will continue serving the stale content for as long as you tell it.
2. Lets say you're beyond that, or your site is too dynamic. Instead of setting up an error page that responds to everything, setup a redirect with the 302 status code (so crawlers and browsers know it's a temporary thing). Point that redirect at an error page and you're golden. The best part is these types of requests use minimal resources.
What I do is kee
@sandys
sandys / systemd-journal-setup.sh
Last active August 29, 2015 13:56
journal setup for systemd
install -d -g root /var/log/journal
setfacl -R -nm g:adm:rx,d:g:adm:rx /var/log/journal
#in /etc/systemd/journald.conf
#comment the following
`#ForwardToSyslog=
#ForwardToKMsg=
#ForwardToConsole=`
@sandys
sandys / api_gunicorn.conf
Last active February 5, 2016 07:20
Rackspace provisioning
import multiprocessing
## Server Socket
bind = 'unix:/opt/user1/run/api.sock'
backlog = 2048
## Worker Processes
workers = multiprocessing.cpu_count() * 2 + 1
worker_class = 'sync'
worker_connections = 1000
@sandys
sandys / default_varnish
Created March 8, 2014 08:41
Varnish file for chefatlarge
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s file,/www/varnish/$INSTANCE/varnish_storage.bin,1G"
@sandys
sandys / full_synclient_config.sh
Last active August 29, 2015 13:58
Linux synclient configuration for two finger scrolling on alps touchpad (Dell Latitude 6410)
Parameter settings:
LeftEdge = 300
RightEdge = 1700
TopEdge = 210
BottomEdge = 1190
FingerLow = 5
FingerHigh = 7
MaxTapTime = 200
MaxTapMove = 107
MaxDoubleTapTime = 200