Skip to content

Instantly share code, notes, and snippets.

View cpliakas's full-sized avatar

Chris Pliakas cpliakas

  • Greater Boston Area
View GitHub Profile
@scor
scor / gist:653fe0869b03ad8d6929
Last active August 29, 2015 14:26
bash alias for code smoke test and PHP linting in a Drupal codebase
alias code-check="find -E . -type f -regex '^.*\.(engine|inc|install|engine|module|php|profile|test|theme|txt|info|rule|view)' | xargs -Ifile bash -c \"php -l file ; (true)\" | grep -v 'No syntax'
find . -type f | xargs -Ifile grep -H '>>>>>>' file| grep -v Binary | grep -v .git/rr-cache"
"UserData": {
"Fn::Base64": { "Fn::Join":["", [
"#!/bin/bash -ex\n",
"apt-get update\n",
"apt-get -y install python-setuptools\n",
"mkdir aws-cfn-bootstrap-latest\n",
"curl https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz | tar xz -C aws-cfn-bootstrap-latest --strip-components 1\n",
"easy_install aws-cfn-bootstrap-latest\n",
"/usr/local/bin/cfn-init --stack ", { "Ref":"AWS::StackName" }, " --resource WebServer", " --region ", { "Ref": "AWS::Region" }, "\n",
"\n",
@philandstuff
philandstuff / scale-summit.org
Last active August 29, 2015 13:57
scale-summit 2014

Scale Summit 2014

Intro, MBS

ideas for sessions

  • bootstrapping environments (without object stores)
  • service discovery
  • removing spofs
@stuart-warren
stuart-warren / CreateJob.sh
Last active March 8, 2024 16:20
Create a job in Jenkins (or folder) using the HTTP API
# check if job exists
curl -XGET 'http://jenkins/checkJobName?value=yourJobFolderName' --user user.name:YourAPIToken
# with folder plugin
curl -s -XPOST 'http://jenkins/job/FolderName/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# without folder plugin
curl -s -XPOST 'http://jenkins/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# create folder
@dmitshur
dmitshur / gist:6927554
Last active September 17, 2023 07:35
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.

WARNING: This gist was created in 2013 and targets the legacy GOPATH mode. If you're reading this in 2021 or later, you're likely better served by reading https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.

$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
@jbuchbinder
jbuchbinder / gorilla_auth.go
Created June 19, 2013 18:22
Gorilla mux + basic authentication from htpasswd file
package main
import (
auth "github.com/abbot/go-http-auth"
"github.com/gorilla/mux"
"log"
"net/http"
"time"
)
@jboner
jboner / latency.txt
Last active May 3, 2024 15:17
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@svenfuchs
svenfuchs / sender.rb
Created December 8, 2010 16:53
attach stdout to eventmachine
require 'rubygems'
require 'eventmachine'
class Sender < EventMachine::Connection
attr_reader :connection
def initialize
@connection = EM.connect('127.0.0.1', 9797)
end
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')