Skip to content

Instantly share code, notes, and snippets.

View MehdiZonjy's full-sized avatar

Mehdi Zonjy MehdiZonjy

View GitHub Profile
#!/bin/bash
cat $1 | base64 -d > result.zlib
printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" | cat - result.zlib | gzip -dc | jq
rm result.zlib
# source https://groups.google.com/forum/#!msg/cloud-custodian/z67zuVApHp0/xX81toqVAgAJ
#!/bin/bash
queue=""
for i in {1..1000}
do
aws sqs receive-message --queue-url $queue --visibility-timeout 600 --max-number-of-messages 10 | jq ".Messages[].Body | fromjson" > $i.json
done
@MehdiZonjy
MehdiZonjy / build-perf
Last active April 6, 2019 10:02
Build Perf
git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
sudo apt-get install sudo apt-get install flex bison libelf-dev libaudit-dev libdw-dev libunwind* python-dev binutils-dev libnuma-dev libgtk2.0-dev libbfd-dev libelf1 libperl-dev libnuma-dev libslang2 libslang2-dev libunwind8 libunwind8-dev binutils-multiarch-dev elfutils libiberty-dev systemtap-sdt-dev libbabeltrace-ctf-dev libbabeltrace-dev -y
cd linux/tools/perf
make
compile and profile memory // -p for profiling performance
stack build --profile --ghc-options=-fprof-auto-top && stack exec -- ui-interactions +RTS -h
generate postscript file from memory dump
~/.stack/programs/x86_64-osx/ghc-8.6.3/bin/hp2ps -e8in -c ui-interactions.hp
limit max heapsize
stack build --ghc-options=-rtsopts
.stack-work/install/x86_64-osx/lts-13.10/8.6.3/bin/ui-interactions -M1G
@MehdiZonjy
MehdiZonjy / go-async-api-call.go
Created August 5, 2018 12:04
async calls in go using channels
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
type Message struct {
Error error