Skip to content

Instantly share code, notes, and snippets.

View chiefy's full-sized avatar
💥

Christopher "Chief" Najewicz chiefy

💥
View GitHub Profile
@GottZ
GottZ / dps.sh
Last active September 22, 2020 20:46
/etc/profile.d/dps.sh
# Docker PS prettifier
# revision 6
# https://gist.github.com/GottZ/4a6c2af314d73cd8b71d
dps() {
docker ps $@ --format "table{{ .Image }}\\t{{ .Names }}\\t{{ .Status }}\\t{{ .Ports }}" | awk '
NR % 2 == 0 {
printf "\033[0m";
}
NR % 2 == 1 {
@grvhi
grvhi / gist:fbda7c0afed03ae1ef8c
Created February 23, 2015 18:30
AWS Lambda Function to Trigger ElasticTranscoder Job on S3 Upload
console.log('Checking newly uploaded file');
var AWS = require('aws-sdk');
var s3 = new AWS.S3({apiVersion: '2006-03-01'});
var eltr = new AWS.ElasticTranscoder({
apiVersion: '2012-09-25',
region: 'us-east-1'
});
// ID of pipeline
var pipelineId = 'myID';
// ID of ET's web output preset
@DrHayt
DrHayt / cloud-config.yml
Last active January 20, 2021 12:03
CoreOS Container Linux etcd3 cluster cloud-config with SSL on peer, server, and client configs.
#cloud-config
ssh_authorized_keys:
- ssh-rsa PutYourKeysHere
coreos:
locksmith:
endpoint: "https://127.0.0.1:2379"
etcd_cafile: /etc/ssl/certs/ca.pem
etcd_certfile: /etc/ssl/client/client.pem
etcd_keyfile: /etc/ssl/client/client.key
@flomotlik
flomotlik / myapp.rb
Created February 24, 2012 13:51
Using Thor subcommands
require 'thor'
require "sub"
class MyApp < Thor
desc "parentcommand SUBCOMMAND", "Some Parent Command"
subcommand "sub", Sub
end
MyApp.start
global
log 127.0.0.1:514 local0
defaults
mode http
log global
option httplog
option http-server-close
option dontlognull
option redispatch
#!/bin/sh
remove_dangling() {
echo "Removing dangling images ..."
docker rmi $(docker images -f dangling=true -q)
}
remove_stopped_containers() {
echo "Removing stopped containers ..."
docker rm $(docker ps -qa)
@sheerun
sheerun / certgen.rb
Last active April 10, 2022 15:39
Docker TLS certificate generator
# Generates necessary certificates to ~/.docker
#
# Usage:
# bundle install
# ruby certgen.rb <domain>
require 'certificate_authority'
require 'fileutils'
if ARGV.empty?
@voxxit
voxxit / USING-VAULT.md
Last active July 7, 2022 03:02
Consul + Vault + MySQL = <3
git clone https://gist.github.com/dd6f95398c1bdc9f1038.git vault
cd vault
docker-compose up -d
export VAULT_ADDR=http://192.168.99.100:8200

Initializing a vault:

vault init
@soplakanets
soplakanets / password.js
Created May 19, 2011 13:20
Password hashing for node.js
var crypto = require('crypto');
var SaltLength = 9;
function createHash(password) {
var salt = generateSalt(SaltLength);
var hash = md5(password + salt);
return salt + hash;
}
@mdwhatcott
mdwhatcott / custom_json.go
Created July 29, 2015 17:15
Example of implementing MarshalJSON and UnmarshalJSON to serialize and deserialize custom types to JSON in Go. Playground: http://play.golang.org/p/7nk5ZEbVLw
package main
import (
"bytes"
"encoding/json"
"fmt"
"strconv"
)
func main() {