Skip to content

Instantly share code, notes, and snippets.

@bool-dev
bool-dev / post-merge
Created February 12, 2016 16:38 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed. In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed. Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@bool-dev
bool-dev / Jinja module loader.md
Created February 8, 2016 10:46 — forked from voscausa/Jinja module loader.md
Jinja2 compiled templates module loader for App Engine Pyhton 2.7.

Jinja compiled templates module loader

This code is part of a Jinja CMS for Google App Engine Python 2.7 and NDB datastore

A Jinja enviroment is created for every CMS site: site_key_id = 'example

The modules are created using compiler.py The resulting code objects are stored in the dadastore using Kind Runtimes and a BlobProperty

The modules can also be saved / downloaded as .pyc in a zip archive: -compiled-templates.zip

@bool-dev
bool-dev / nginx.default.conf
Created November 25, 2015 13:36 — forked from sumardi/nginx.default.conf
Install PHP-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and PHP-FPM
sudo yum install -y nginx php-fpm
# Install PHP extensions
sudo yum install -y php-devel php-mysql php-pdo \
php-pear php-mbstring php-cli php-odbc \
@bool-dev
bool-dev / sendy-server
Created November 25, 2015 12:09 — forked from refringe/sendy-server
Nginx configuration file example for Sendy (http://sendy.co/).
server {
listen 80;
listen [::]:80;
server_name domain.com;
autoindex off;
index index.php index.html;
root /srv/www/domain.com/public;
@bool-dev
bool-dev / pre-push.sh
Created November 19, 2015 16:27 — forked from pixelhandler/pre-push.sh
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
#!/usr/bin/env ruby
# Aside from removing Ruby on Rails specific code this is taken verbatim from
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome
# - Ryan Florence (http://ryanflorence.com)
#
# Install this hook to a remote repository with a working tree, when you push
# to it, this hook will reset the head so the files are updated
if ENV['GIT_DIR'] == '.'
@bool-dev
bool-dev / pysyslog.py
Last active August 26, 2015 10:01 — forked from marcelom/pysyslog.py
Tiny Python Syslog Server
#!/usr/bin/env python
## Tiny Syslog Server in Python.
##
## This is a tiny syslog server that is able to receive UDP based syslog
## entries on a specified port and save them to a file.
## That's it... it does nothing else...
## There are a few configuration parameters.
LOG_FILE = 'youlogfile.log'
@bool-dev
bool-dev / app.py
Created July 6, 2014 08:54 — forked from kkung/app.py
from flask import Flask, request, session, url_for, redirect, \
render_template, abort, g, flash
from werkzeug.contrib.sessions import Session, SessionStore
from cPickle import HIGHEST_PROTOCOL
from random import random
from flask import json
class MemcachedSessionStore(SessionStore):
def __init__(self, servers=None, key_prefix=None, default_timeout=300):
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
/* modernizr-test.js
* Daniel Ott
* 3 March 2011
* Custom Tests using Modernizr's addTest API
*/
/* iOS
* There may be times when we need a quick way to reference whether iOS is in play or not.
* While a primative means, will be helpful for that.
*/