Skip to content

Instantly share code, notes, and snippets.

pendolf@warhummer:~/hule/nado?$ vnstat -d
wlo1 / daily
day rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
02/22/2019 689.61 MiB | 70.32 MiB | 759.94 MiB | 73.78 kbit/s
02/23/2019 1.55 MiB | 282 KiB | 1.83 MiB | 0.18 kbit/s
02/24/2019 723.45 MiB | 15.70 MiB | 739.15 MiB | 71.76 kbit/s
02/25/2019 1.45 GiB | 60.24 MiB | 1.51 GiB | 150.45 kbit/s
$ smartctl -a -s on /dev/disk3
smartctl 6.3 2014-07-26 r3976 [x86_64-apple-darwin14.1.0] (local build)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: SandForce Driven SSDs
Device Model: KINGSTON SH103S3240G
Serial Number: 50026B724A07B6AF
LU WWN Device Id: 5 0026b7 24a07b6af
Firmware Version: 580ABBF0
@pendolf
pendolf / logger.go
Created November 24, 2016 17:54
gokit log example
type Logger interface {
Log(keyvals ...interface{}) error
}
func With(logger Logger, keyvals ...interface{}) Logger
func NewJSONLogger(w io.Writer) Logger
func NewLogfmtLogger(w io.Writer) Logger
type Valuer func() interface{}
func Caller(depth int) Valuer
@pendolf
pendolf / gitignore.md
Created July 19, 2016 10:36 — forked from nepsilon/gitignore.md
Understand what .gitignore rule is ignoring your files — First published in fullweb.io issue #54

Understand what .gitignore rule is ignoring your files

Ready to commit, you fire your git status and you don’t see your files 🤔.

Use this command to ask Git what rule is causing this ignore:

$ git check-ignore -v filename

For instance to see what rule ignores tests.pyc:

@pendolf
pendolf / git-change-commit-messages.md
Created July 19, 2016 10:21 — forked from nepsilon/git-change-commit-messages.md
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

{
"version": 8,
"name": "pendolf",
"metadata": {
"mapbox:autocomposite": true,
"mapbox:type": "template",
"mapbox:groups": {
"1444849364238.8171": {
"name": "Buildings",
"collapsed": true
@pendolf
pendolf / better-flow-control.py
Created June 9, 2016 13:23 — forked from nepsilon/python-better-flow-control.md
Better Flow Control with Python
try:
# What you want to do, which might
# very well raise an exception
except IndexError as ex:
# What do to when IndexError is raised
except MyModule.itsException as ex:
# What do to when MyModule raised an exception
except Exception as ex:
# What do to when any other Exception is raised
else:
@pendolf
pendolf / .gitconfig
Created June 9, 2016 13:21 — forked from nepsilon/a-better-setup-for-git.md
A better setup for Git
# The basics, who you commit as:
[user]
name = John Doe
email = john@doe.org
# Your Github username
[github]
user = githubusername
# Some aliases to save 1000s keystrokes each year:
[alias]
log = log --color
@pendolf
pendolf / python-timeit.py
Created June 9, 2016 13:20 — forked from nepsilon/python-timeit.md
A simple way to benchmark your code in Python
import random
def sort_rand():
random.seed('pouet')
pool = [random.random() for i in range(1000)]
sorted_pool = sorted(pool)
return sorted_pool
if __name__ == "__main__":
sorted_nb = sort_rand()
@pendolf
pendolf / cron-tips.sh
Created June 9, 2016 13:20 — forked from nepsilon/cron-tips.md
Better using Cron
# Cron only provides a limited environment.
# To simulate it to test run your scripts
# first add this to your cron:
* * * * * env > ~/cronenv
# This will export the limited cron environment to a file.
# Now launch a new shell using this file to test your scripts:
$ env - `cat ~/cronenv` /bin/sh
# Tell it what email to send output to:
# (You need to install Postfix locally before)