Skip to content

Instantly share code, notes, and snippets.

View cypreess's full-sized avatar

Kris Dorosz cypreess

View GitHub Profile

Keybase proof

I hereby claim:

  • I am cypreess on github.
  • I am cypreess (https://keybase.io/cypreess) on keybase.
  • I have a public key whose fingerprint is CF75 0598 9BFD 5FFC 2541 902E 07FD 403C C58D 9C5D

To claim this, I am signing this object:

vagrant@precise64:/vagrant/monitor$ python monitor.py eth1 --log BLEH -i 100 -vv
2014-05-09 19:17:29,850 - INFO - FAMTAR Monitor starting for interfaces: eth1
2014-05-09 19:17:29,850 - INFO - BW min: 0.60 BW max: 0.90
2014-05-09 19:17:29,850 - DEBUG - [eth1] getting address
2014-05-09 19:17:29,854 - INFO - [eth1] has address: sh: 1: /usr/local/xorp/sbin/xorpsh: not found
2014-05-09 19:17:29,854 - DEBUG - [eth1] getting starting cost
2014-05-09 19:17:29,858 - INFO - [eth1] has starting cost: sh: 1: /usr/local/xorp/sbin/xorpsh: not found
2014-05-09 19:17:29,859 - DEBUG - [eth1] speed = 1000, BW_MIN = 600000000 bit/s, BW_MAX = 900000000 bit/s
2014-05-09 19:17:29,859 - DEBUG - [eth1] counter = 468 B
2014-05-09 19:17:29,860 - DEBUG - Waiting 100 miliseconds
@cypreess
cypreess / gist:3302004d3244501f7c8c
Created June 30, 2014 15:57
AWK is 3x slower than PYTHON :(
# The task: cut column 1 and 2 and reorder them 2,1
# TLDR: python 15s awk 1m24s on 1.2 GB text file
# WAT?
# Dataset:
iMac27~/dev/awk_vs_python ls -alh test_data.2
-rw-r--r-- 1 cypreess staff 1.2G Jun 30 17:33 test_data.2
export HISTTIMEFORMAT='%F %T '
export CLICOLOR="YES"
export LSCOLORS="Fxgxcxdxcxegedabagacad"
alias l="ls -lFoh"
alias la="ls -lFohA"
alias xclip='xclip -selection c'
alias grep="grep --color"
alias su="su -"
@cypreess
cypreess / left_pad.py
Created June 7, 2018 08:22
Snipty multi file support demonstration
def left_pad(s, n, c):
return s.rjust(len(s) + n, c)
from logging import getLogger
from django.db import connection
logger = getLogger(__name__)
class QueryCountDebugMiddleware(object):
"""
This middleware will log the number of queries run
and the total time taken for each request (with a
status code of 200). It does not currently support
import shortuuid
from django.db import models
def shorten_name(name):
if len(name) <= 3:
return name.lower()
else:
return name[0].lower() + ''.join([ch for ch in name[1:].lower() if ch not in 'aeiouy'][:2])
@cypreess
cypreess / example.py
Created June 7, 2018 09:26
Snipty example snippet
print("Snipty is awesome!")
Znamy przyczynę śmierci Roberta Brylewskiego. Są wyniki sekcji zwłok
PIOTR HALICKI dzisiaj 13:33
FACEBOOK | 20
TWITTER | 2
He he
E-MAIL
KOPIUJ LINK 0SKOMENTUJ
Niewydolność krążeniowo-oddechowa była przyczyną śmierci Roberta Brylewskiego – dowiedział się Onet. Tak wynika ze wstępnych wyników przeprowadzonej dziś sekcji znaeenego muzyka. Na razie jednak nie ustalono, czy miało to związek z wcześniejszym brutalnym pobiciem Brylewskiego. Będzie to jeszcze przedmiotem dalszych badań.