Skip to content

Instantly share code, notes, and snippets.

View sammcj's full-sized avatar
🦃

Sam sammcj

🦃
View GitHub Profile
@sammcj
sammcj / Bash CGI Locate Search
Created June 20, 2011 23:24
CGI Locate Search - Warning: Insecure, only use on local apache instances
@sammcj
sammcj / gist:9f78532774081f0ecbbd
Created September 24, 2014 04:04
Docker cgroup memory monitoring - one liner
for line in `docker ps | awk '{print $1}' | grep -v CONTAINER`; do docker ps | grep $line | awk '{printf $NF" "}' && echo $(( `cat /sys/fs/cgroup/memory/docker/$line*/memory.usage_in_bytes` / 1024 / 1024 ))MB ; done
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
#!/usr/bin/python
import argparse
import sqlite3 as lite
import os
def _open_db(db):
try:
con = lite.connect(db)
cur = con.cursor()
@sammcj
sammcj / gist:10820760be5e2454178c
Last active August 29, 2015 14:11
migrate_gitlab
#!/bin/sh
# Upgrades from gitlab installed via puppet module to a new server with gitlab omnibus (installed with puppet)
#
# Assumes:
# - Databases have been copied to /var/tmp/gitlab(_ci).sql
# - Repositories are to be located at /mnt/repositories
#
# Note:
# - Ensure any hooks / scripts you have are correctly pathed, for example:
# Dont use: #!/usr/bin/env python , Instead use: #!/usr/bin/python
#################################################################################
# start and stop the vpn from the command line from now on with these two commands
# or rename the aliases as you see fit.
#################################################################################
alias startvpn="sudo launchctl load -w /Library/LaunchDaemons/net.juniper.AccessService.plist; open -a '/Applications/Junos Pulse.app/Contents/Plugins/JamUI/PulseTray.app/Contents/MacOS/PulseTray'"
alias quitvpn="osascript -e 'tell application \"PulseTray.app\" to quit';sudo launchctl unload -w /Library/LaunchDaemons/net.juniper.AccessService.plist"
@sammcj
sammcj / keybase.md
Created February 8, 2015 04:57
keybase.md

Keybase proof

I hereby claim:

  • I am sammcj on github.
  • I am smcleod (https://keybase.io/smcleod) on keybase.
  • I have a public key whose fingerprint is C048 9C81 1626 D34B 8888 D465 0775 B1EE C972 4BAF

To claim this, I am signing this object:

@sammcj
sammcj / logstash_shard_logs
Created February 9, 2015 00:04
logstash_shard_logs
[2015-02-09 11:01:55,754][WARN ][cluster.action.shard ] [int-elastic-01-ES1] [logstash-2015.02.09][4] sending failed shard for [logstash-2015.02.09][4], node[h73_BCI-SW6MkRoE0-3QsA], [R], s[INITIALIZING], indexUUID [ZA9X4b31QJKB3oYlHUhrlA], reason [Failed to start shard, message [RecoveryFailedException[[logstash-2015.02.09][4]: Recovery failed from [int-elastic-03-ES1][qlMwQhWoRIedLZ5r23eCcw][int-elastic-03][inet[/10.51.11.189:9300]] into [int-elastic-01-ES1][h73_BCI-SW6MkRoE0-3QsA][int-elastic-01][inet[10.51.11.252/10.51.11.252:9300]]]; nested: RemoteTransportException[[int-elastic-03-ES1][inet[/10.51.11.189:9300]][internal:index/shard/recovery/start_recovery]]; nested: RecoveryEngineException[[logstash-2015.02.09][4] Phase[2] Execution failed]; nested: RemoteTransportException[[int-elastic-01-ES1][inet[/10.51.11.252:9300]][internal:index/shard/recovery/translog_ops]]; nested: MapperParsingException[failed to parse [timestamp]]; nested: MapperParsingException[failed to parse date field [Feb 9 11:00:01]
@sammcj
sammcj / metadata
Last active August 29, 2015 14:15
ES - Logstash - Shard 2 - Stuck Initialising
{
state: open
settings: {
index: {
creation_date: 1423612800416
uuid: 5RVYfow_S82_Tjroj7IPwA
number_of_replicas: 1
analysis: {
analyzer: {
@sammcj
sammcj / index info
Created February 12, 2015 00:03
ES - Logstash - Shard 2 - Stuck Initialising
{
index: {
primary_size_in_bytes: 178562276
size_in_bytes: 318436825
}
translog: {
operations: 9516
}
docs: {