Skip to content

Instantly share code, notes, and snippets.

View whyvez's full-sized avatar

Yves Richard whyvez

View GitHub Profile
@whyvez
whyvez / README.md
Last active September 23, 2015 17:55
plot

README is empty

@whyvez
whyvez / convert.sh
Last active September 21, 2015 16:18
Blackberry memo backup file converter
for memo in *.memo
do
awk 'NR == 1 {gsub("*", ""); gsub("/", ""); filename = $0 "-" FILENAME} NR > 1 {print $0 >> "new/" filename}' $memo
done
@whyvez
whyvez / handler.js
Created August 21, 2015 17:35
lambda container reuse state issue
/*
The current container reuse strategy in AWS Lambda makes it very hard to ensure consistent environments between invocations.
Managing environments is currently the responsibility of the user. There should be some additional cleanup tasks ran after
an invocation to ensure at least a freah new nodejs context. As an example I added the setInterval issue we've seen.
*/
// new container a
// * invocation 1 on container a
// - using setInterval to check remaining time every 1 sec
@whyvez
whyvez / install-mawk.sh
Created August 11, 2015 01:46
Intall mawk
#!/usr/bin/env bash
wget http://invisible-island.net/datafiles/release/mawk.tar.gz
tar -xzvf mawk.tar.gz
cd mawk-1.3.4-20150503
./configure
make
sudo make install
@whyvez
whyvez / pg-disk-usage.txt
Created August 7, 2015 17:19
pg disk storage
http://www.postgresql.org/docs/9.1/static/app-vacuumdb.html
https://wiki.postgresql.org/wiki/Disk_Usage
@whyvez
whyvez / backup
Last active August 29, 2015 14:24
#!/bin/bash
SERVER=yourwebsite.com
tar -cjf- ~/.crypt/passwd ~/.ssh ~/.bashrc ~/.profile ~/.vimrc ~/.gitconfig \
~/.config/chromium ~/.mozilla \
| openssl enc -aes-256-cbc \
| ssh $SERVER 'cat>~/www/backup/`date +%F.%T`'
ssh $SERVER 'ls -1 ~/www/backup | grep ^[0-9] | sort > ~/www/backup/list.txt'
@whyvez
whyvez / url-parse_s3key.txt
Created June 24, 2015 12:51
node url.parse(s3key)
url.parse('s3://tesera.datathemes/tesera.afgo.pgyi/uploads/yves.richard@tesera.com/aply/e11cb037-1b1d-432a-ab33-c41025b41cde/stage/datapackage.zip')
{
"protocol": "s3:",
"slashes": true,
"auth": null,
"host": "tesera.datathemes",
"port": null,
"hostname": "tesera.datathemes",
@whyvez
whyvez / switch.sh
Created June 22, 2015 16:40
aws linux swicth to root user
sudo su -
@whyvez
whyvez / swap.sh
Created June 5, 2015 13:04
pgyi swap ds company
COMPANY=TSI; mkdir -p $COMPANY; for csv in *.csv; do awk -F, -v COMPANY=$COMPANY 'NR > 1 {OFS=","; $1=COMPANY}1' $csv > ./$COMPANY/$csv; done
@whyvez
whyvez / checkfkey.sh
Created June 1, 2015 01:41
PGYI fkey checker
#!/usr/bin/env bash
# checks pgyi dataset for fkey integrity
# will print out any offending records
# usage: bash ./fkeycheck.sh <csv_data_folder>
# example: bash ./fkeycheck.sh ./examples/pgyi/data
wd=$1
plot=$wd/plot.csv