Skip to content

Instantly share code, notes, and snippets.

View richbs's full-sized avatar

Richard Barrett-Small richbs

View GitHub Profile
@ajdruff
ajdruff / fix-git-line-endings
Last active February 29, 2024 13:02
Forces all line endings to LF in your git repo.
#####################
#
# Use this with or without the .gitattributes snippet with this Gist
# create a fixle.sh file, paste this in and run it.
# Why do you want this ? Because Git will see diffs between files shared between Linux and Windows due to differences in line ending handling ( Windows uses CRLF and Unix LF)
# This Gist normalizes handling by forcing everything to use Unix style.
#####################
# Fix Line Endings - Force All Line Endings to LF and Not Windows Default CR or CRLF
@sunyatasattva
sunyatasattva / nightwatch-performance.js
Created August 3, 2016 16:07
A performance command for Nightwatch
var util = require("util");
var EventEmitter = require("events").EventEmitter;
function PerformanceMetrics() {
EventEmitter.call(this);
}
util.inherits(PerformanceMetrics, EventEmitter);
@Khoulaiz
Khoulaiz / gist:41b387883a208d6e914b
Last active May 3, 2024 15:57
Checking ports without telnet

Here are several different ways to test a TCP port without telnet.

$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C

$ cat &lt; /dev/tcp/127.0.0.1/23
@zachleat
zachleat / gist:2008932
Created March 9, 2012 21:56
Prevent zoom on focus
// * iOS zooms on form element focus. This script prevents that behavior.
// * <meta name="viewport" content="width=device-width,initial-scale=1">
// If you dynamically add a maximum-scale where no default exists,
// the value persists on the page even after removed from viewport.content.
// So if no maximum-scale is set, adds maximum-scale=10 on blur.
// If maximum-scale is set, reuses that original value.
// * <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=2.0,maximum-scale=1.0">
// second maximum-scale declaration will take precedence.
// * Will respect original maximum-scale, if set.
// * Works with int or float scale values.
@yuchant
yuchant / sorl_pil_engine.py
Created February 27, 2012 01:29
Sorl Thumbnail PIL Engine that accepts PNG conversion to JPG with background color
"""
Sorl Thumbnail Engine that accepts background color
---------------------------------------------------
Created on Sunday, February 2012 by Yuji Tomita
"""
from PIL import Image, ImageColor
from sorl.thumbnail.engines.pil_engine import Engine
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@kenzie
kenzie / crontab
Created June 15, 2011 23:13
Wifi Switch via Cron on a Mac
# open Terminal.app
# sudo crontab -e
MAILTO=email@address.com
# networksetup -setairportnetwork <network> <device name> [password]
0 9 * * 1-5 /usr/sbin/networksetup -setairportnetwork AirPort "3G" "password"
0 17 * * 1-5 /usr/sbin/networksetup -setairportnetwork AirPort "DSL" "password"
@glenbot
glenbot / Git Issue Export for Pivotal
Created January 6, 2011 23:57
Export your open issues in github to a pivotal tracker friendly csv for import, requires github2 python api-client
import csv
from github2.client import Github
# api settings for github
git_username = 'your_git_username'
git_api_token = 'your_git_api_token'
git_repo = 'username/repo_name'
# import all issues as this story type
pivotal_story_type = 'Bug'
@christian-oudard
christian-oudard / term_colors.py
Created October 28, 2009 14:54
Terminal output colors in python
from __future__ import print_function
"""
Utilities for 256 color support in terminals.
Adapted from:
http://stackoverflow.com/questions/1403353/256-color-terminal-library-for-ruby
The color palette is indexed as follows:
0-15: System colors