This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#============================== | |
# | |
# ALIASES | |
# | |
#============================== | |
# Add an "alert" alias for long running commands. Use like so: | |
# sleep 10; alert | |
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/#([a-fA-F0-9]{3}){1,2}\b/ | |
/#([a-f0-9]{3}){1,2}\b/i | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Commit early, commit often: it is a bad idea to do a lot of work without committing. | |
[user] | |
name = <Github Username> | |
email = <Github Email> | |
# signingkey = <GPGKEYIDHERE> | |
[commit] | |
# gpgsign = true | |
[push] | |
default = simple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
def transaction(fn): | |
'''Decorator that encloses the decorated function in a DB transaction. | |
The decorated function does not need to session.commit(). Usage:: | |
@transaction | |
def my_function(): # (...) | |
If any exception is raised from this function, the session is rewinded. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6018 | Books | |
---|---|---|
6000 | Business | |
6022 | Catalogs | |
6017 | Education | |
6016 | Entertainment | |
6015 | Finance | |
6023 | Food and Drink | |
6014 | Games | |
6013 | Health and Fitness | |
6012 | Lifestyle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# source: https://gist.github.com/francoisromain/58cabf43c2977e48ef0804848dee46c3 | |
# and another script to delete the directories created by this script | |
# project-delete.sh: https://gist.github.com/francoisromain/e28069c18ebe8f3244f8e4bf2af6b2cb | |
# Call this file with `bash ./project-create.sh project-name` | |
# - project-name is mandatory | |
# This will creates 4 directories and a git `post-receive` hook. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def producer(name : String, &generator : -> T) forall T | |
Channel(T).new.tap { |ch| | |
spawn(name: name) do | |
loop do | |
ch.send generator.call | |
end | |
end | |
} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def producer(name : String, &generator : -> T) forall T | |
Channel(T).new.tap { |ch| | |
spawn(name: name) do | |
loop do | |
ch.send generator.call | |
end | |
end | |
} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def producer(name : String, &generator : -> T) forall T | |
Channel(T).new.tap { |ch| | |
spawn(name: name) do | |
loop do | |
ch.send generator.call | |
end | |
end | |
} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GDB commands by function - simple guide | |
--------------------------------------- | |
More important commands have a (*) by them. | |
Startup | |
% gdb -help print startup help, show switches | |
*% gdb object normal debug | |
*% gdb object core core debug (must specify core file) | |
%% gdb object pid attach to running process | |
% gdb use file command to load object |
OlderNewer