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
remove shift = Shift_R | |
remove lock = Caps_Lock | |
remove mod5 = Mode_switch | |
add control = Caps_Lock | |
add mod3 = Mode_switch | |
keysym Shift_R = Mode_switch | |
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
/** | |
* Check if a given foreign key exists in the model (given its name). | |
*/ | |
public function validateForeignKey($field){ | |
$associations = array_map( | |
create_function('$v', 'return $v["foreignKey"];'), | |
$this->belongsTo | |
); | |
$aliases = array(); |
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
#!/usr/bin/env bash | |
# Utility script which googles for the data contained inside positional | |
# arguments or for everything stored inside the WM clipboard. | |
# | |
# If the content of either positional argumets or clipboard starts with | |
# http,ftp,ecc (which means it is already a valid url), then skip the | |
# url-stuffing bit. | |
# | |
# Depends on xclip and xdg-open |
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
#!/usr/bin/env python | |
from __future__ import print_function | |
from __future__ import division | |
def maximize(func, a, b, precision): | |
(left, right) = (a, b) | |
while True: | |
if right - left <= precision: |
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 -e | |
# | |
# Usage: browser | |
# pipe html to a browser | |
# e.g. | |
# $ echo '<h1>hi mom!</h1>' | browser | |
# $ ron -5 man/rip.5.ron | browser | |
OPEN=xdg-open | |
if [ -t 0 ]; then |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 | |
""" | |
This is a module which exports functions implementing the ternary search | |
algorithm: | |
http://en.wikipedia.org/wiki/Ternary_search | |
In particular the module exports functions to minimize/maximize a given function |
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
#!/usr/bin/env bash | |
# Utility script which creates and display a QR code with the content of | |
# positional arguments or with everything stored within the WM clipboard. | |
# | |
# Depends on xclip, curl and xdg-open | |
set -e | |
TEMP="" |
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
function tail_from() { | |
tail -n 0 -f $2 > /tmp/tail_from.$$ & | |
tac $2 | sed "/$1/q" | tac | sed '/^$/d' | |
tail -c +1 -f /tmp/tail_from.$$ | |
kill %% | |
rm /tmp/tail_from.$$ | |
} |
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
#!/usr/bin/env python | |
"""Script showing how to use decorators to recover from failed function calls | |
""" | |
import sys | |
import time | |
def backoff1(step): | |
def wrapper1(func): |
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
#!/usr/bin/env sh | |
ROSWELL_URL=https://github.com/roswell/roswell/releases/download/v19.09.12.102/roswell_19.09.12.102_amd64.zip | |
OS_WIN=$(uname -s | grep -e MSYS_NT) | |
if [ -n "$OS_WIN" ]; then | |
ROSWELL_IN_PATH=$(echo $PATH | grep -F /tmp/roswell) | |
if [ -z "$ROSWELL_IN_PATH" ] ; then | |
echo "/tmp/roswell not found \$PATH" | |
exit 1 |
OlderNewer