Skip to content

Instantly share code, notes, and snippets.

View sandeepone's full-sized avatar
💭
I may be slow to respond.

Sandeep Sangamreddi sandeepone

💭
I may be slow to respond.
View GitHub Profile
# Taken from: https://docs.docker.com/examples/apt-cacher-ng/
FROM ubuntu
MAINTAINER sandeepone@gmail.com
VOLUME /var/cache/apt-cacher-ng
RUN apt-get update && apt-get install -y apt-cacher-ng
EXPOSE 3142
CMD chmod 777 /var/cache/apt-cacher-ng && \
/etc/init.d/apt-cacher-ng start && \
@sandeepone
sandeepone / site.conf
Created December 31, 2016 12:54 — forked from paskal/site.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
@sandeepone
sandeepone / pre-compress-web-assets
Created December 21, 2016 21:34 — forked from rabin-io/pre-compress-web-assets
Recursively pre-compress (gzip) CSS/JavaScript/webfont assets for use Nginx and the HttpGzipStaticModule module.
#!/bin/bash
###########################################################################
# Usage:
# pre-compress-web-assets [.|folder_name]
#
# This script will recursively look for the files in the $ext variable
# and compress/re-compress them.
#
# By default it will look into the current working folder,
@sandeepone
sandeepone / gist:03f56e8df4cf65da968625fc5fa8402f
Created December 15, 2016 13:27 — forked from rjacoby/gist:46f7ceb900f97b0cc8f4
Facebook STOP! console code
__d("Chromedome", ["fbt"], function(a, b, c, d, e, f, g) {
f.start = function(h) {
if (h.off || top !== window ||!/(^|\.)facebook\.com$/.test(document.domain))
return;
var i = h.stop || "Stop!", j = h.text || "This is a browser feature intended for developers. If someone told you to copy-paste something here to enable a Facebook feature or \"hack\" someone's account, it is a scam and will give them access to your Facebook account.", k = h.more || g._("For more information, see {url}.", [g.param("url", 'https://www.facebook.com/selfxss')]);
if ((window.chrome || window.safari)&&!h.textonly) {
var l = 'font-family:helvetica; font-size:20px; ';
[[i, h.c1 || l + 'font-size:50px; font-weight:bold; ' + 'color:red; -webkit-text-stroke:1px black;'], [j, h.c2 || l], [k, h.c3 || l], ['', '']].map(function(r) {
setTimeout(console.log.bind(console, '\n%c' + r[0], r[1]));
});
@sandeepone
sandeepone / jquery.textareaAutoResize.js
Created July 9, 2016 10:01 — forked from nothinking/jquery.textareaAutoResize.js
javascript: jquery.textareaAutoResize.js
/**
* This jQuery plugin resizes a textarea to adapt it automatically to the content.
* @author Amaury Carrade
* @version 1.1
*
* @example $('textarea').autoResize({
* animate: { // @see .animate()
* enabled: true, // Default: false
* duration: 'fast', // Default: 100
* complete: function() {}, // Default: null
@sandeepone
sandeepone / golang_job_queue.md
Created March 17, 2016 16:26 — forked from harlow/golang_job_queue.md
Job queues in Golang
// Worker represents the worker that executes the job
type Worker struct {
JobChannel chan Job
quit chan bool
}
func NewWorker(jobChannel chan Job) Worker {
return Worker{
JobChannel: jobChannel,
quit: make(chan bool)}

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2015-09-24-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@sandeepone
sandeepone / .git-fix-whitespaces.sh
Created September 24, 2015 05:30 — forked from larsxschneider/.git-fix-whitespaces.sh
Pre-commit hook script for git to fix various source file things.
#!/bin/sh
# Pre-commit hook for git which removes trailing whitespace, converts tabs to spaces, and enforces a max line length.
# The script does not process files that are partially staged. Reason: The `git add` in the last line would fully
# stage a file which is not what the user wants.
if git rev-parse --verify HEAD >/dev/null 2>&1 ; then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
@sandeepone
sandeepone / README.md
Last active September 21, 2015 04:00
Async Redis PubSub using HHVM-EXT-UV

RedisSubscribe

This is a truly async POC Redis client using LibUV. The LibUV extension used here is hhvm-ext-uv by RickySu. That extension has some problems with the latest version of HHVM and has a multiloop branch that I compiled and used.