Skip to content

Instantly share code, notes, and snippets.

View alertedsnake's full-sized avatar

alertedsnake

  • 10:23 (UTC -04:00)
View GitHub Profile
@alertedsnake
alertedsnake / .tmux.conf
Created November 25, 2015 14:46
Some useful tmux options, like making it use ^a like screen does
start-server
set -g prefix C-a
unbind C-b
bind C-a send-prefix
set -g status-keys vi
setw -g mode-keys vi
set -g status off
unbind ^L
bind ^L refresh-client
@alertedsnake
alertedsnake / stupidboto3.py
Last active September 2, 2019 17:31
Get a list of instances in an AWS autoscaling group, with boto3. I set MaxRecords=2 to experiment with the pagination, it does seem to return the whole list when not set, but.....
import boto3
def as_get_instances(client, asgroup, NextToken = None):
# this is downright ridiculous because boto3 sucks
irsp = None
if NextToken:
irsp = client.describe_auto_scaling_instances(MaxRecords=2, NextToken=NextToken)
else:
@alertedsnake
alertedsnake / gist:7dd9b87e47b1246fab93
Last active August 17, 2020 08:08
Use custom node + npm for Jenkins job
# setup python virtualenv and install nodeenv
virtualenv .python
. .python/bin/activate
pip install nodeenv
# setup nodeenv with the node of your choice, and upgrade npm to latest
nodeenv --node=0.10.37 --prebuilt .node
. .node/bin/activate
npm install -g npm
set_prompt() {
Last_Command=$? # Must come first!
Gray='\[\e[01;30m\]'
Blue='\[\e[01;34m\]'
White='\[\e[01;37m\]'
Purple='\[\e[0;35m\]'
Red='\[\e[01;31m\]'
Green='\[\e[01;32m\]'
Reset='\[\e[00m\]'
FancyX='\342\234\227'
@alertedsnake
alertedsnake / ldappasswd
Last active August 29, 2015 14:19
Generate OpenLDAP SSHA password
import getpass
import hashlib
import os
from base64 import urlsafe_b64encode as encode
def make_secret(password):
salt=os.urandom(4)
sha = hashlib.sha1(password)
sha.update(salt)
digest_salt_b64 = '{}{}'.format(sha.digest(), salt).encode('base64').strip()