Skip to content

Instantly share code, notes, and snippets.

View texdc's full-sized avatar
🕶️

George Cooksey texdc

🕶️
  • Nashville, TN
View GitHub Profile
@jwage
jwage / SplClassLoader.php
Last active April 9, 2024 21:04
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@gcatlin
gcatlin / gist:1847248
Created February 16, 2012 19:43
Install specific version of Homebrew formula
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
@shanestillwell
shanestillwell / user-data.sh
Created July 17, 2012 22:18
Amazon User Data script
#!/bin/bash
### BEGIN INIT INFO
# Provides: ec2-run-user-data
# Required-Start: $network $local_fs $remote_fs $syslog $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Run EC2 user-data scripts
# Description: On first boot of EC2 instance, runs user-data if it starts with #!
@afternoon
afternoon / jenkins-user-script.sh
Created October 4, 2012 23:09
User data script to spin up a Ubuntu-based Jenkins server on the EC2 clouds
#!/bin/bash
#
# User data script which sets up Jenkins on Ubuntu using Puppet
#
# For example:
#
# $ ec2-run-instances ami-5a19976a -t m1.small --region us-west-2 \
# --key ec2-keypair --user-data-file Desktop/jenkins-user-script.sh
# $ ssh -i ~/.ssh/ec2-keypair-us-west-2 \
# ubuntu@ec2-xxx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com
@joshareed
joshareed / GithubClient.groovy
Last active March 2, 2023 21:26
Fetch list of issues from Github and draft an email
//#!/usr/bin/env groovy
import groovy.json.JsonSlurper
import java.text.SimpleDateFormat
// fetches a Github API URL and parses the result as JSON
def fetch(addr, params = [:]) {
def auth = "<personal api token>"
def json = new JsonSlurper()
return json.parse(addr.toURL().newReader(requestProperties: ["Authorization": "token ${auth}".toString(), "Accept": "application/json"]))
@juampynr
juampynr / mymodule.info
Last active June 9, 2023 21:53
Drupal 7 Views 3 custom field handler
dependencies[] = ctools
; Views Handlers
files[] = views/mymodule_handler_handlername.inc
@Ocramius
Ocramius / MyModule\AbstractEntityControllerFactory.php
Last active October 21, 2017 12:55
ZF2 Abstract controller factory to handle numerous doctrine entities at once
<?php
namespace MyModule;
use Zend\ServiceManager\AbstractFactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\ServiceManager\AbstractPluginManager;
class AbstractEntityControllerFactory implements AbstractFactoryInterface
{
@garlandkr
garlandkr / snapshot.py
Created September 20, 2013 14:05
Make EBS snapshots based on tags
untitled text 3.txt
untitled text 31.txt
#!/usr/bin/env python
import boto
import argparse
import time, datetime, sys, logging, socket, re
from dateutil.relativedelta import relativedelta
def get_creds():
@wdalmut
wdalmut / gist:7711857
Created November 29, 2013 20:50
Change postgres default password
sudo -u postgres psql postgres
# \password postgres
Enter new password:
@Ocramius
Ocramius / HashCracker.php
Last active January 1, 2016 04:49
Timing Attack simulation - just a very simple dummy to help understanding timing attacks. https://twitter.com/Ocramius/status/415055831608991744
<?php
require_once __DIR__ . '/stupidStringComparison.php';
class HashCracker
{
private $range = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
private $length = 32;
private $cycles = 1000;