Skip to content

Instantly share code, notes, and snippets.

View mbigatti's full-sized avatar

Massimiliano Bigatti mbigatti

View GitHub Profile

Emoticons for commit messages

General

  • 🚧 work in progress

Primary activities

  • ⚡, 🔼 improvement
  • ➕ when adding feature
  • ➖ when removing feature
  • 🐛 when fixing a bug
@mbigatti
mbigatti / gist:7e82d5a6cdb7bbcb84746ed01019304c
Created June 17, 2019 14:57
Dump Java classes using Guava
ClassPath cp = ClassPath.from(this.getClass().getClassLoader());
cp.getAllClasses().stream()
.filter(ci -> ci.getName().startsWith("com.example"))
.forEach(ci -> System.err.println(ci.getName()));
#!/bin/bash
#
# decompress - a bash script file to decompress a batch of rar files
#
password=$1
file_count=$(ls *.part01.rar 2> /dev/null | wc -l)
if [ "$file_count" -eq "0" ]
then
echo "No file to decompress"
# install and run db2 docker image
# see: https://hub.docker.com/r/ibmcom/db2express-c/
docker pull ibmcom/db2express-c
docker create -v $(pwd):/dbdata --name dbstore ibmcom/db2express-c /bin/true
docker run -it -p 50000:50000 -e DB2INST1_PASSWORD=db2inst1-pwd -e LICENSE=accept --name db2 --volumes-from dbstore ibmcom/db2express-c:latest bash
su - db2inst1
# -> db2start
# --> db2 create database WWSCM on /dbdata dbpath on /dbdata
@mbigatti
mbigatti / gist:b7d2e4f374942e8c7589
Created October 5, 2015 07:54
Useful OS X Folders (Mavericks)
Content Folder
Your documents ~/Documents and ~/Desktop
iTunes data and settings ~/Music/iTunes/
iPhoto data and settings ~/Pictures/iPhoto Library/
Movies ~/Movies
Books ~/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books
Mail data and settings ~/Library/Mail/V2
Contacts data and settings ~/Library/Application Support/AddressBook
Calendar data and settings ~/Library/Calendars/
Safari data and settings ~/Library/Safari/
@mbigatti
mbigatti / add-remove-tags.sh
Created September 1, 2015 09:37
Git commands
# add tag
git tag -a 1.0 -m "Version 1.0"
git push --tags
# remove tag
git tag -d 1.1
git push origin :refs/tags/1.1
@mbigatti
mbigatti / stop-resume.sh
Created September 1, 2015 09:36
Stop and resume Unix process
# first param is pid
# stop
kill -STOP $1
# resume
kill -CONT $1
@mbigatti
mbigatti / dump.sh
Created September 1, 2015 09:35
Dump http traffic on local machine
sudo tcpdump -A -s0 -ien1 port 80
@mbigatti
mbigatti / count_files.sh
Created May 13, 2015 07:39
Count files in subdirectories
find . -type f | wc -l
@mbigatti
mbigatti / recent_files.sh
Created December 4, 2014 10:32
List most recent 10 files, long format
ls -lrt | tail -n 10