Skip to content

Instantly share code, notes, and snippets.

View Frodox's full-sized avatar
🎯
Focusing

Vitaly Rybnikov Frodox

🎯
Focusing
View GitHub Profile
# Geany's snippets configuration file
#
# use \n or %newline% for a new line (it will be replaced by the used EOL char(s) - LF, CR/LF, CR).
# use \t or %ws% for an indentation step, it will be replaced according to the current document's indent mode.
# use \s to force whitespace at beginning or end of a value ('key= value' won't work, use 'key=\svalue').
# use %key% for all keys defined in the [Special] section.
# use %cursor% to define where the cursor should be placed after completion. You can define multiple
# %cursor% wildcards and use the "Move cursor in snippet" to jump to the next defined cursor
# position in the completed snippet.
# You can define a section for each supported filetype to overwrite default settings, the section
@Frodox
Frodox / pygtk-screenshot.py
Last active August 29, 2015 14:26
Taking a screenshot of the active window with using pygtk
#!/usr/bin/env python
#http://faq.pygtk.org/index.py?req=show&file=faq23.039.htp
try :
import gtk.gdk
except ImportError :
print 'You need to install pygtk'
exit(1)
@Frodox
Frodox / git-pre-receive-hook.sh
Last active August 29, 2015 14:25 — forked from caniszczyk/git-pre-receive-hook.sh
A reasonable git pre-receive-hook
#!/bin/sh
#
# For each ref, validate the commit.
#
# - It disallows deleting branches without a /.
# - It disallows non fast-forward on branches without a /.
# - It disallows deleting tags without a /.
# - It disallows unannotated tags to be pushed.
@Frodox
Frodox / time.md
Last active August 29, 2015 14:13 — forked from linse/time.md

The Unix time command

man time is a good start - on Linux you get the GNU time version.

Note: some shells (e.g.,bash(1)) have a built-in time command that provides less functionality than the command described here. To access the real command, you may need to specify its pathname (something like /usr/bin/time).

GNU time

A call of /usr/bin/time gives a lot of information:

/usr/bin/time ls > /dev/null
@Frodox
Frodox / get-ip-of-virtualbox-vm.sh
Last active February 18, 2020 20:27
How to know IP of VM in VirtualBox
#!/bin/bash
VBoxManage list runningvms
VBoxManage guestproperty get "VM_NAME" "/VirtualBox/GuestInfo/Net/0/V4/IP"
# NOTE: work only if guest vm have VboxAdditions installed
@Frodox
Frodox / gist:6e2d62e65660a4fa0c34
Created December 11, 2014 11:11
parallel commands with xargs
xargs < Makefile -P $(nproc) -I{} echo -e "{}\n"
for f in "$@"
do
TMP=$(mktemp)
SIZE_OLD=$(wc -c < "$f")
echo "Optimizing '$f' of size $SIZE_OLD"
/usr/bin/gs \
-sDEVICE=pdfwrite \
-dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/ebook \
-dNOPAUSE \
@Frodox
Frodox / pdf2img.sh
Created November 13, 2014 06:39
convert pdf to multiple images
#!/bin/bash
# allow to convert multipage pdfs
convert -verbose -density 200 -trim schedule_rus_fin.pdf -quality 90 zeronight%d.jpg
@Frodox
Frodox / detect-endianes.sh
Created November 3, 2014 14:52
Detect, if you have BE/LE system from shell
#!/bin/bash
# little endian - forward byte order
# big endian - reverse byte order
echo "You have 32 bit system (1), 64bit (0)"
echo -n I | od -to2 | head -n1 | cut -f2 -d" " | cut -c6
# cc: http://serverfault.com/questions/163487/linux-how-to-tell-if-system-is-big-endian-or-little-endian
@Frodox
Frodox / download-java1.8.5.sh
Created July 16, 2014 21:01
download java binary
#!/bin/sh
wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz