Skip to content

Instantly share code, notes, and snippets.

View glamrock's full-sized avatar
🐝
hacking on things at Berkman <3

Griffin Boyce glamrock

🐝
hacking on things at Berkman <3
View GitHub Profile
def insert_comma(mystring, position):
mystring[:position] + ',' + mystring[position:]
offset = 0
for magic_number in magic_numbers:
position = magic_number + offset
mystring = insert_comma(mystring, position)
offset += 1
@glamrock
glamrock / RETA-2000example.dat
Created October 22, 2018 16:08
One RETA entry from 2000
117LANPD001C7004348817Y 0812823530121000484674036598000000000 000000000 0004658280000000000000000002Y0NNEW ORLEANS LA CHIEF OF POLICE RECORDS & IDENTIFICATION 715 SOUTH BROAD STREET NEW ORLEANS, LA 701191170E1 0008300022222PPPP0000000000000030000200001000010000100000000000000000001000000000000000000000000100000000000000000000000010000000000000000000000006000000000000010000000002200021000010022600140000140001300059001910008500045000490000000012003840030300059000220140300571003800012500066028070000000000000050000000009000090000000071000410000000008000220017000063000430005300000000110007300056000160000100388000690005500010000040078500000000000000000000000000000000000000090000100000000020000600016000050000400004000000000300010000090000100000000470001600010000030000300098000000000000000000000210008300055555PPPP0000000000000030000300000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000
@glamrock
glamrock / mysql-mirror.sh
Created May 9, 2018 20:09 — forked from peta/mysql-mirror.sh
Simple bash script for migrating MySQL databases (including all associated user accounts) to a remote server. Use it with care because the usage of mysqldump in this script solely relies on default values which may vary greatly on your machine. (mysqldump is a powerful tool, so don't miss `man mysqldump`).
#!/bin/bash
# Copyright (c) 2005 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# Source: http://www.cyberciti.biz/tips/move-mysql-users-privileges-grants-from-one-host-to-new-host.html
# Author Vivek Gite <vivek@nixcraft.com>,
# Peter Geil <code@petergeil.name>
# ------------------------------------------------------------
# SETME First - local mysql user/pass
_lusr="src-db-user"
_lpass="src-db-pw"
@glamrock
glamrock / .vimrc
Created June 19, 2017 18:27 — forked from assaf/.vimrc
.vimrc
version 7.0
if &cp | set nocp | endif
let s:cpo_save=&cpo
set cpo&vim
let &cpo=s:cpo_save
unlet s:cpo_save
set cscopeprg=/usr/bin/cscope
set cscopetag
set cscopeverbose
set fileencodings=utf-8,latin1
@glamrock
glamrock / .vimrc
Created June 8, 2017 19:46
hella vimrc options
" Include user's local vim before config
if filereadable(expand("~/.vimrc.before"))
source ~/.vimrc.before
endif
""
"" Basic Setup
""
set nocompatible " use vim, no vi defaults
@glamrock
glamrock / .gitconfig
Created June 6, 2017 14:06 — forked from robmiller/.gitconfig
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
#! /bin/bash
IPLIST="ips.txt"
while read IP; do
echo ""
echo "$IP"
whois "$IP" | grep descr
whois "$IP" | grep changed
dig -x "$IP" +short | head -1
@glamrock
glamrock / tweet_dumper.py
Created March 30, 2017 16:17 — forked from yanofsky/LICENSE
A script to download all of a user's tweets into a csv
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
access_key = ""
@glamrock
glamrock / etc - ganglia - gmond.conf
Last active March 6, 2017 22:36
ganglia default config files
/* This configuration is as close to 2.5.x default behavior as possible
The values closely match ./gmond/metric.h definitions in 2.5.x */
globals {
daemonize = yes
setuid = yes
user = ganglia
debug_level = 0
max_udp_msg_len = 1472
mute = no
deaf = no
@glamrock
glamrock / rrd_exporter.sh
Last active June 23, 2020 10:25
Ganglia rrd export / import
#! /bin/bash -xe
# Note: run from /var/lib/ganglia directory, no need for subdir
# Run with: find /var/lib/ganglia/rrds/ -type d -exec sh -c 'cd "{}" ; /var/lib/ganglia/rrd_exporter.sh ;' \;
# backup current rrd files -- tar all and place in /tmp
tar --exclude='*.xml' -cvf /tmp/rrds-"$(date --date='now' +%F-%R)".tar rrds/*
echo "Backed up files in /tmp"
#Pull in rrd files one at a time
for i in *.rrd