Skip to content

Instantly share code, notes, and snippets.

View texdc's full-sized avatar
🕶️

George Cooksey texdc

🕶️
  • Nashville, TN
View GitHub Profile
@xbeta
xbeta / 00-set-authorization.groovy
Created November 25, 2014 23:38
put them in $JENKINS_HOME/init.groovy.d/
import jenkins.model.*;
import hudson.security.*;
// JVM did not like 'hypen' in the class name, it will crap out saying it is
// illegal class name.
class BuildPermission {
static buildNewAccessList(userOrGroup, permissions) {
def newPermissionsMap = [:]
permissions.each {
newPermissionsMap.put(Permission.fromId(it), userOrGroup)
@YarGnawh
YarGnawh / ec2-hostname.sh
Last active March 2, 2016 21:47
AWS EC2 Ubuntu Update HOSTNAME Using JSON USER_DATA
#!/bin/bash
# Write to /usr/local/ec2/ec2-hostname.sh
# Execute chmod 755 ec2-hostname.sh
# Append /usr/local/ec2/ec2-hostname.sh to /etc/rc.local
# Referenced: http://ternarylabs.com/2010/09/15/automatically-configure-hostname-for-new-ec2-instances/
USER_DATA=`/usr/bin/curl -s http://169.254.169.254/latest/user-data`
IPV4=`/usr/bin/curl -s http://169.254.169.254/latest/meta-data/public-ipv4`
<?php
interface UbiquitousLanguage
{
public function enter(BoundedContext $boundedContext);
}
interface BoundedContext
{
public function getNames();
@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;
@wdalmut
wdalmut / gist:7711857
Created November 29, 2013 20:50
Change postgres default password
sudo -u postgres psql postgres
# \password postgres
Enter new password:
@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():
@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
{
@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
@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"]))
@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