Skip to content

Instantly share code, notes, and snippets.

View Hammond95's full-sized avatar

Martin Hammond95

View GitHub Profile
@griggheo
griggheo / gist:1340429
Created November 4, 2011 20:43
EMR automation
#!/bin/bash
TIMESTAMP=`date "+%Y%m%d%H%M"`
EMR_DIR=/opt/emr
LOG_FILE=$EMR_DIR/run_emr_cluster.log.$TIMESTAMP
START=`date "+%Y-%m-%d %H:%M"`
echo $START > $LOG_FILE
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active July 4, 2024 17:31
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@bfritz
bfritz / ruby_filter_base64_decode_example.sh
Last active July 7, 2023 00:25
logstash base64 decode with ruby filter
$ cat base64_decode.conf
input {
stdin { }
}
filter {
grok {
match => ["message", "%{WORD:prefix} %{WORD:b64} %{WORD:suffix}"]
}
@tito
tito / gist:9414743
Last active May 10, 2018 10:04
Cython optimization ideas (goal: reduce size for mobile)

Cython optimization ideas

Theses ideas is not good or bad, but are just experimentation to see the cost of a feature on the final binary size. All the tests came from the original execution of cython on kivy/graphics/texture.pyx. 40927 bytes.

A fresh compile using the default options give:

original: 899262
stripped: 187200
@jbarratt
jbarratt / nbgrep
Last active April 27, 2023 15:00
'nbgrep', search the code of all your ipython notebooks
#!/bin/bash
# usage: nbgrep 'pattern'
SEARCHPATH=~/work/
# 'jq' technique lifted with gratitude
# from https://gist.github.com/mlgill/5c55253a3bc84a96addf
# Break on newlines instead of any whitespace
@kamermans
kamermans / install_jq.sh
Created January 22, 2015 17:21
Install jq (JSON Command Line processor)
#!/bin/bash -e
# This scripts installs jq: http://stedolan.github.io/jq/
JQ=/usr/bin/jq
curl https://stedolan.github.io/jq/download/linux64/jq > $JQ && chmod +x $JQ
ls -la $JQ
@jlln
jlln / separator.py
Last active November 9, 2023 19:59
Efficiently split Pandas Dataframe cells containing lists into multiple rows, duplicating the other column's values.
def splitDataFrameList(df,target_column,separator):
''' df = dataframe to split,
target_column = the column containing the values to split
separator = the symbol used to perform the split
returns: a dataframe with each entry for the target column separated, with each element moved into a new row.
The values in the other columns are duplicated across the newly divided rows.
'''
def splitListToRows(row,row_accumulator,target_column,separator):
split_row = row[target_column].split(separator)
@amalgjose
amalgjose / GetAWSSummary.py
Last active April 3, 2020 12:45
Program to find get the summary of EMR clusters and EC2 instances running across all regions in an AWS account. This program can be executed via cron to get summary alerts in periodic intervals. An HTML email will be generated and send to the list of recipients mentioned in program. In this program, EMR and EC2 service summary are only considere…
__author__ = 'Amal G Jose'
import sys
import smtplib
import time
import boto
import boto.ses
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
@julz
julz / main.go
Created November 20, 2015 12:39
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {