Skip to content

Instantly share code, notes, and snippets.

View romach's full-sized avatar

Roman Cherepanov romach

View GitHub Profile
@romach
romach / create-synchronized-list.java
Last active April 6, 2017 09:33
Create synchronized list
List<Object> objects = Collections.synchronizedList(new ArrayList<Object>());
@romach
romach / create-ssh-tunnel.sh
Last active October 4, 2017 17:13
Create ssh tunnel
# forvard local 9000 port to remote 3306 port on 123.456.789.12
ssh -L 9000:localhost:3306 [email protected] -p 22
@romach
romach / change-date-to-past.sh
Last active April 6, 2017 13:24
Change date to 2 days in past
# back in past for 2 days
sudo date -s "$(date --date '-2 day')"
# back in past for 1 hour
sudo date -s "$(date --date '-1 hour')"
# set date
sudo date -s "17 Sep 2016 09:44:00"
@romach
romach / update-docker-service.sh
Created April 6, 2017 19:31
Update docker service
docker service update --env-add "UPDATE_DATE=$(date)" --env-add "TZ=CET" service
@romach
romach / run-cron-on-odd-and-even-minutes.sh
Last active April 6, 2017 21:01
Run cron on odd and even minutes
# Run cron on odd minute
1-59/2 * * * * date >>/tmp/odd
# Run cron on even minute
*/2 * * * * date >>/tmp/even
@romach
romach / show-all-user-permissions.sql
Created April 7, 2017 12:36
Show all users permissions in MySql
select * from information_schema.user_privileges;
@romach
romach / format-int-with-leading-zeroes.java
Created April 7, 2017 22:37
Format int with leading zeroes
String.format("%05d", yournumber);
@romach
romach / show-lightweight-tags-with-dates.sh
Created April 7, 2017 22:53
Show lightweight tags with dates
git log --tags --simplify-by-decoration --pretty="format:%ai %d"
@romach
romach / make-screenshot-in-ubuntu.txt
Last active April 8, 2017 09:13
Make screenshot and screencast in Ubuntu
Kazam
@romach
romach / screenshot-shortcuts-in-ubuntu.txt
Created April 8, 2017 09:13
Screenshot shortcuts in Ubuntu
Screenshot of wondow - Alt + Print
Screenshot of area - Shift + Print