Skip to content

Instantly share code, notes, and snippets.

View jwhitcraft's full-sized avatar
🏠
Working from home (always)

Jon Whitcraft jwhitcraft

🏠
Working from home (always)
View GitHub Profile
@brentertz
brentertz / rvm2rbenv.txt
Created November 21, 2011 23:00
Switch from RVM to RBENV
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################
@padraic
padraic / escaping-rfc.md
Created July 7, 2012 14:27
Escaping RFC for PHP Core - Basically Zend\Escaper in C

* Version: 1.0

* Date: 2012-09-18

* Author: Pádraic <padraic.brady.at.gmail.com>

* Status: Under Discussion

* First Published at: http://wiki.php.net/rfc/escaper

@jvandyke
jvandyke / .gitconfig
Last active January 27, 2023 08:11
Use PHPStorm/WebStorm for git diff and merge tools
# ~/.gitconfig
# Add this to your global git configuration file
# Change phpstorm to webstorm, if you use that.
# Diff and merge tool changes
# Run `git difftool <directory/file>...` or `git mergetool <directory/file>...`
[merge]
tool = phpstorm
[diff]
tool = phpstorm
@chicks
chicks / DB2_Install_Steps.sh
Last active December 8, 2018 13:04
Sugar and DB2 on CentOS 6.4
# Disable SELinux
echo 0 > /selinux/enforce
perl -pi -e 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
# Install required packages
yum install pdksh compat-libstdc++-33 compat-libstdc++-33.i686 libaio libaio.i686 \
pam-1.1.1-17.el6.x86_64 pam-1.1.1-17.el6.i686 nfs-utils openssh-clients \
numactl
# Update Kernel Parameters (http://ibm.co/1czEKb4)
@leolara
leolara / debounce.go
Last active July 25, 2022 09:25
Golang port of underscore.js
func debounceChannel(interval time.Duration, output chan int) chan int {
input := make(chan int)
go func() {
var buffer int
var ok bool
// We do not start waiting for interval until called at least once
buffer, ok = <-input
// If channel closed exit, we could also close output
@Godefroy
Godefroy / backup-mysql.sh
Created August 21, 2015 09:19
Instant backup of a MySQL database with LVM snapshot
#! /bin/bash
## Instant backup of a MySQL database with LVM snapshot
## Author: Godefroy de Compreignac (@Godefroy)
## License: Beerware
# Instructions:
# - MySQL Data on DB server must be an logical LVM partition
# - Backup server must have ssh root access to DB server
# - Master status is saved at the exact moment of snapshot to allow restoration of master-slave replication
@markan
markan / vpncfix.md
Created August 21, 2015 17:52
shimo/vpnc "ERROR: can't send packet: Can't assign requested address"

The problem

I've frequently been bit by failures restarting my vpn on my Mac. The connection may appear to start up in Shimo (the menu icon will change) but it looks like vpnc can't connect.

Looking at the log, we see the connection gets stuck

ERROR: can't send packet: Can't assign requested address

This has plagued me for a while, and my only fix has been to restart the machine. I hate restarting my machine. So I finally made time to dig in and find a better solution

@vrivellino
vrivellino / ec2_cloud.groovy
Last active January 20, 2022 11:11
Jenkins EC2 Plugin Configuration via Groovy
/*
* Configure the Jenkins EC2 Plugin via Groovy Script
* EC2 Plugin URL: https://wiki.jenkins-ci.org/display/JENKINS/Amazon+EC2+Plugin
*/
import hudson.model.*
import jenkins.model.*
import hudson.plugins.ec2.*
import com.amazonaws.services.ec2.model.InstanceType
@ftclausen
ftclausen / Jenkinsfile
Created April 13, 2017 05:36
Jenkins pipeline - An approach to get all commits since the last successful build.
// -*- mode: groovy -*-
// vim: set filetype=groovy :
node( 'some_node' ) {
stage( "Phase 1" ) {
sshagent( credentials: [ 'some_creds' ] ) {
checkout scm
def lastSuccessfulCommit = getLastSuccessfulCommit()
def currentCommit = commitHashForBuild( currentBuild.rawBuild )
if (lastSuccessfulCommit) {
@michaeljoy
michaeljoy / percona-toolkit-my.cnf
Last active November 18, 2019 14:24
pt-heartbeat systemd init script example - percona tookit systemd examples
[mysql]
host=localhost
socket=/var/run/mysqld/mysqld.sock
[client]
host=localhost
socket=/var/run/mysqld/mysqld.sock