Skip to content

Instantly share code, notes, and snippets.

View dserodio's full-sized avatar
🐕

Daniel Serodio dserodio

🐕
View GitHub Profile
@dserodio
dserodio / scrap.sh
Last active November 29, 2018 15:27
ps(1) tips and tricks
# show process start time for a give PID (GNU ps)
ps -o lstart= -p $PID
# show process start time for all processes (GNU ps)
ps ax -O lstart
# show process environment variables (BSD grep)
ps -Eww -p $PID
@pokstad
pokstad / rediswebpy.py
Created September 7, 2011 23:02
Redis session store backend for web.py
import redis
import web
SESSION = 'SESSION:'
class RedisStore(web.session.Store):
"""Store for saving a session in redis:
import rediswebpy
session = web.session.Session(app, rediswebpy.RedisStore(), initializer={'count': 0})
@koreno
koreno / README.md
Last active April 1, 2020 10:44
'rebaser' improves on 'git rebase -i' by adding information per commit regarding which files it touched.

Prebase

git-prebase improves on 'git rebase -i' by adding information per commit regarding which files it touched.

  • Each file gets an alpha-numeric identifier at a particular column, a list of which appears below the commit list. (The identifiers wrap around after the 62nd file)
  • Commits can be moved up and down safely (without conflicts) as long as their columns don't clash (they did not touch the same file).

Installation

Add the executable to your path and git will automatically expose it as

@jerrac
jerrac / gitlab2elk.yml
Created March 23, 2015 22:19
Logstash and Logstash-Forwarder config for GitLab logs
# YAML config for these Ansible roles:
# https://github.com/LaneCommunityCollege/aspects_logstash
# https://github.com/LaneCommunityCollege/aspects_logstash_forwarder
#
# Since it's just straight config blocks, you should be able to just copy and paste what you need if you don't use
# those Ansible roles.
#
# End result is multiline logs combined into one, and dates are parsed correctly.
aspects_logstash_rules:
window.fluid.dockBadge = '';
setTimeout(updateDockBadge, 1000);
setTimeout(updateDockBadge, 3000);
setInterval(updateDockBadge, 5000);
function updateDockBadge() {
var navigation = document.querySelector('[role=navigation]')
var doc = navigation.contentDocument || navigation.ownerDocument;
@coldnebo
coldnebo / Default (Linux).sublime-keymap
Created August 10, 2011 23:20
simple scripts to prettify your xml and json in sublime text 2
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
@axelav
axelav / gist:1839777
Created February 15, 2012 22:51 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@coderberry
coderberry / BCrypt.java
Created October 28, 2010 15:39
BCrypt.java
// Copyright (c) 2006 Damien Miller <djm@mindrot.org>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES

Source Code Typography

Presentation: http://www.slideshare.net/vancura/source-code-typography

Quotes

Dumb quotes (also known as straight quotes) are straight and vertical. Proper typography never uses straight quotes. They are left over from the age of typewriters, and their only modern use is for coding.

@bradmontgomery
bradmontgomery / ipython_magic_function_inspector.py
Last active February 9, 2022 11:02
An IPython Magic function that will pretty-print python objects with syntax highlighting.
"""
An IPython magic function to pretty-print objects with syntax highlighting.
See, "Defining your own magics":
http://ipython.org/ipython-doc/stable/interactive/reference.html#defining-your-own-magics
For more on Pygments:
http://pygments.org/docs/quickstart/
Usage