Skip to content

Instantly share code, notes, and snippets.

View draganHR's full-sized avatar

Dragan Bošnjak draganHR

View GitHub Profile
<?xml version="1.0"?>
<settings>
<console change_refresh="10" refresh="100" rows="25" columns="80" buffer_rows="500" buffer_columns="0" shell="" init_dir="" start_hidden="0" save_size="0" background_text_opacity="255">
<colors background_text_opacity="255">
<color id="0" r="27" g="25" b="24"/>
<color id="1" r="64" g="126" b="231"/>
<color id="2" r="123" g="151" b="38"/>
<color id="3" r="61" g="151" b="184"/>
<color id="4" r="242" g="44" b="64"/>
<color id="5" r="102" g="102" b="234"/>
@draganHR
draganHR / format-python2.6.md
Created November 26, 2015 09:39
Cheat sheet for "new style" string formatting in Python 2.6.

Cheat sheet for "new style" string formatting in Python 2.6. It is modified version of examples from http://pyformat.info/ Difference is that simplest sytaxt ( '{}'.format('foo') ) does not work in Python 2.6 and you need to specify value index for each value ( '{0}'.format('foo') ).

Format:

'{1} {0}'.format('one', 'two')

Align right:

#!/usr/bin/env python
"""
Instructions:
- Put this file at ~/.pythonrc.py
- Add `export PYTHONSTARTUP=~/.pythonrc.py` to ~/.bashrc
Source:
@draganHR
draganHR / override.conf
Created January 29, 2016 09:19
systemd custom login
#!/bin/bash
# /usr/bin/ttyentrypoint
error_exit() {
echo "[ERROR] $1"
exit
}
exec /bin/bash -c 'reset; echo "Do stuff..."; sleep 10;'
@draganHR
draganHR / .bashrc
Last active March 10, 2016 07:21
rbash jail
# .bashrc
enable -n alias
enable -n bg
enable -n bind
enable -n break
enable -n builtin
enable -n caller
enable -n cd
enable -n command
SELECT COUNT(*) FROM networkevents_networkevent;
count
----------
13773196
(1 row)
Time: 1115.687 ms
@draganHR
draganHR / Makefile-npm-alchemy
Last active June 17, 2016 21:21
Install npm packages and sync them to vagrant shared directory
export INSTALL_PATH := ${HOME}/node-libs.tmp
npm-delete:
rm -rf ${INSTALL_PATH}
rm -rf node_modules
npm-install:
mkdir -p node_modules
mkdir -p ${INSTALL_PATH}
cp package.json ${INSTALL_PATH}/package.json
import gc
import sys
import operator
def total_size():
return sum(sys.getsizeof(i) for i in gc.get_objects())
def total_count():
  • Name: ESLint
  • Link name: ESLint Warnings
  • Trend report name: Trend report name

Regular expression

([^:]+):(\d+):(\d+): ([^\[\]]+)\[([\w-]+)\/([\w-]+)]

Mapping Script

from __future__ import absolute_import, unicode_literals
import logging
from itertools import count
from time import sleep
from tornado.ioloop import IOLoop
from tornado.web import asynchronous, RequestHandler
from multiprocessing.pool import ThreadPool