Skip to content

Instantly share code, notes, and snippets.

@lrusev
lrusev / tools.txt
Last active October 3, 2016 10:16
Bash tools list
#Terminal highlighter
#svn diff -rHEAD|colordiff|aha --black > output.html
apt-get install colordiff
apt-get aha
apt-get pygmentize
#image optimizer
apt-get install optimpng
apt-get install jpegoptim
@lrusev
lrusev / bash_aliases
Last active May 19, 2017 11:27
List of bash aliases
#To checkout use following command
#git clone https://gist.github.com/c7a18eab9043c79b278c8343c1a7b2b7.git .aliases_gist
#
#Add code below to your .bashrc
# if [ -d ~/.aliases_gist -a -f ~/.aliases_gist/bash_aliases ]; then
# . ~/.aliases_gists/bash_aliases
# fi
# Close editor and refresh bash state by:
# source ~/.bashrc
#
@lrusev
lrusev / term
Created July 21, 2016 13:12
IT term gather
#!/bin/bash
set -e
function loadTermsPage() {
local url="http://www.consp.com/it-terminology-dictionary-$LETTER"
curl -s $url|sed ':a;N;$!ba;s/\n/ /g'|grep -Po "<table.*</table>"|lynx --dump --stdin -nolist
}
if [ ! -d "./.terms" ]; then
mkdir "./.terms"
#!/bin/bash
/usr/bin/notify-send -u critical "Tip of a day" -t 3000 "$(tip)" --icon=dialog-information
#!/bin/bash
function taocl() {
curl -s https://raw.githubusercontent.com/jlevy/the-art-of-command-line/master/README.md |
pandoc -f markdown -t html |
xmlstarlet fo --html --dropdtd |
xmlstarlet sel -t -v "(html/body/ul/li[count(p)>0])[$RANDOM mod last()+1]" |
xmlstarlet unesc | fmt -80
}
*/5 * * * * export DISPLAY=0.0 && export DBUS_SESSION_BUS_ADDRESS=$(ps -u lgrusev e | grep -Eo 'dbus-daemon.*address=unix:abstract=/tmp/dbus-[A-Za-z0-9]{10}' | tail -c35) && tip-message
@lrusev
lrusev / phpcs.xsl
Created February 26, 2016 13:40
PHPCS XML report transfromation
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" encoding="UTF-8"/>
<!-- TODO customize transformation rules
syntax recommendation http://www.w3.org/TR/xslt
-->
<xsl:template match="/">
<html>
<head>
@lrusev
lrusev / pcat
Created February 2, 2016 09:19
highlight file content from command line
alias pcat="pygmentize -f terminal256 -O style=native -g"
@lrusev
lrusev / serve
Created February 2, 2016 09:19
Local server alias
alias serve="xdg-open ~/Documents/refresh.html 2>&1 > /dev/null; python -m SimpleHTTPServer 8889"
------------------------------refresh.html-------------------------
<html>
<head>
<meta http-equiv="refresh" content="1;url=http://localhost:8889/" />
</head>
<body>
Redirect to <a href="http://localhost:8889">http://localhost:8889</a>
</body>
@lrusev
lrusev / composer.json
Last active January 28, 2016 11:05
Global composer dependencies
{
"require": {
"phpunit/phpunit": "^4.6",
"halleck45/phpmetrics": "^1.7",
"hirak/prestissimo": "^0.1.4",
"sebastian/phpcpd": "*",
"sebastian/phpdcd": "*",
"phpmd/phpmd": "*",
"squizlabs/php_codesniffer": "*"
}