Skip to content

Instantly share code, notes, and snippets.

@chrislaskey
chrislaskey / GIF-Screencast-OSX.md
Created Oct 10, 2017 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@chrislaskey
chrislaskey / spec-js-generate_fixtures.js
Created Aug 8, 2016
Generate deserialized test fixtures objects from JSON:API response data
View spec-js-generate_fixtures.js
#!/usr/bin/env node
var fixtures = [
"spec/js/react/apps/fixtures/index.json",
"spec/js/react/apps/fixtures/show.json"
]
var fs = require("fs")
var Deserializer = require("jsonapi-serializer").Deserializer
var deserialize = new Deserializer({keyForAttribute: "camelCase"}).deserialize
View basic-example.js
var reducer = (state = {}, action) => {
switch action.type {
case "CUSTOM_ACTION":
return merge({}, state, {value: action.value});
default:
state
}
}
View keybase.md

Keybase proof

I hereby claim:

  • I am chrislaskey on github.
  • I am chrislaskey (https://keybase.io/chrislaskey) on keybase.
  • I have a public key whose fingerprint is 8CD3 5967 D382 DEE0 28CD F5AA ABF2 E964 4FA7 88C0

To claim this, I am signing this object:

@chrislaskey
chrislaskey / profile.pp
Created Feb 19, 2014
Avoiding circular includes when using the profiles / roles pattern in Puppet
View profile.pp
# Lesson: always use root scope when including a puppet module inside a profile or role file, e.g.:
# include ::module
# Wrong way
class profile::mail::exim {
include exim
# This expands to current namespace first:
# include profile::mail::exim
# Causing a circular dependency. Include does not throw duplicate errors, so this fails silently.
# Intended 'exim' module is never loaded
@chrislaskey
chrislaskey / RequestParser.py
Last active Dec 20, 2015
A real world example of a Python Flask utility class used in the simpledocs.co and chrisandgitte.com projects. The gist shows the progression from a minimum viable product first, to a refactored library class for general use. The unit tests used in the refactor are appended in a final commit for completeness.
View RequestParser.py
#
# File lib/requestparser.py
#
class RequestParser:
def parse(self, flask_request):
self.request = flask_request
return self._parse_request()
@chrislaskey
chrislaskey / .htaccess
Last active Dec 17, 2015
Apache .htaccess configuration for auto-appending `.php` filename extension.
View .htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]
# The two RewriteCond rules are boilerplate, they make sure files that exist
# on the server (CSS, JS, images, etc) will not have their URLs rewritten and
# be served directly.
# The RewriteRule captures all remaining URL requests, and adds a .php to the end.
@chrislaskey
chrislaskey / flask_application.wsgi
Created Feb 23, 2013
Example of a basic .WSGI template for Python Flask deployments using Apache with Mod_WSGI
View flask_application.wsgi
#!/usr/bin/env python
# Adding the current directory to the Python path is easy:
import os
import sys
this_dir = os.path.dirname(__file__)
sys.path.insert(0, this_dir)
# Now that the Python path includes the current directory, any
# application specific modules can be loaded just like this was
@chrislaskey
chrislaskey / iptables.rules
Created Jan 15, 2013
Example generic iptable rules file for forwarding traffic from port 80 to port 8080, used in this case for configuring Jenkins/Hudson to run on port 80. Initial commit is the default iptable rules' output from `iptables-save > /etc/iptables.up.rules` on Ubuntu Server 12.04. The revised commit are the updated rules to forward traffic from port 80…
View iptables.rules
## Filter Table
*filter
:INPUT ACCEPT [971:197590]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [95:9682]
-A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
-A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT
COMMIT