Skip to content

Instantly share code, notes, and snippets.

View ericzumba's full-sized avatar
😀

Eric ericzumba

😀
View GitHub Profile
@ericzumba
ericzumba / count.sh
Last active September 14, 2015 22:11
count log lines per second
cat log/chupacabra.log | grep -o -E "[0-9]{2}:[0-9]{2}:[0-9]{2}" | uniq -c
# matches the whole date at the begining of the line
tail -n 100 log/chupacabra.log | grep -o -E "^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}" | uniq -c
@ericzumba
ericzumba / gist:7186a75f310044e62406
Last active September 30, 2015 21:14
how many docs added on solr per sec
tail -F /var/solr/logs/solr.log | grep --line-buffered -o -E "([0-9]* add)" | awk '{print strftime("%Y-%m-%d %r"), $1}'
tail -F /var/solr/logs/solr.log | grep --line-buffered -o -E "([0-9]* add)" | awk '{print strftime("%Y-%m-%d-%H-%M-%S"), $1}'
@ericzumba
ericzumba / parallel-delete.sh
Created November 18, 2015 19:24
cat to parallel
cat all_deleted | parallel --pipe -N100 -j100 ./delete_sns.rb
@ericzumba
ericzumba / gist:2b8868faf2d5bac048a4
Created February 26, 2016 22:13
mac avoid 10.0.2.0/24 ip range clashes
VBoxManage modifyvm "default" --natnet1 "10.13.2.0/24"
gradle_version=2.12
wget -N https://services.gradle.org/distributions/gradle-${gradle_version}-all.zip
mkdir -p /opt/gradle
unzip gradle-${gradle_version}-all.zip
mv gradle-${gradle_version} /opt/gradle/
ln -sfn gradle-${gradle_version} /opt/gradle/latest
chown -R ec2-user:ec2-user /opt/gradle
printf "export GRADLE_HOME=/opt/gradle/latest\nexport PATH=\$PATH:\$GRADLE_HOME/bin" > /etc/profile.d/gradle.sh
. /etc/profile.d/gradle.sh
# check installation
@ericzumba
ericzumba / move-internal-git-folder-to-its-own-repo
Created April 28, 2016 19:25
Git: Moving an internal folder to its own repo
cp -r old-repo new-repo
cd new-repo
git remote rm origin
git clean -fd
git filter-branch --subdirectory-filter internal-folder -- branch-to-hold-on-to
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
git checkout branch-to-hold-on-to
git tag | xargs -I {} git tag -d {}
git branch | grep -v "*" | xargs -I {} git branch -D {}
@ericzumba
ericzumba / iso-date-grep-mask
Created May 2, 2016 19:37
iso date grep mask
[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z
@ericzumba
ericzumba / docker-remove-all-containers-and-images.sh
Last active May 4, 2016 16:37
remove all docker containers and images
# copied from https://techoverflow.net/blog/2013/10/22/docker-remove-all-images-and-containers/
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
export $(cat config/prod.config | xargs ) && make deploy
docker run --net host -ti redis:3