- filter on parent/child relationship
class SomeResource(Resource):
# always use a string with the full path of the resource
parent = fields.ForeignKey('path.to.module.SomeResource',
attribute='parent')
class Meta:
#!/bin/bash | |
# source: https://wiki.tox.im/Binaries#Linux | |
sudo sh -c 'echo "deb https://repo.tox.im/ nightly main" > /etc/apt/sources.list.d/toxrepo.list' | |
wget -qO - https://repo.tox.im/pubkey.gpg | sudo apt-key add - | |
sudo apt-get install apt-transport-https #for https repos | |
sudo apt-get update | |
echo "Tox Repository Installed." | |
echo "You can now install utox, qtox, toxic, ratox and tox-bootstrapd" | |
echo "just type: sudo apt-get install utox qtox toxic ratox tox-bootstrapd" |
colors | |
* get the eclipse color theme plugin at http://marketplace.eclipse.org/content/eclipse-color-theme | |
* set NightLion Aptana Theme | |
font | |
* in preferences Colors and Fonts, Text Font | |
* linux: Monospace size 13 | |
* osx: Menlo size 16-18 |
class SomeResource(Resource):
# always use a string with the full path of the resource
parent = fields.ForeignKey('path.to.module.SomeResource',
attribute='parent')
class Meta:
# create ./stampit to stamp all PDF files with a given text | |
# adopted from http://www.commandlinefu.com/commands/view/9984/stamp-a-text-line-on-top-of-the-pdf-pages. | |
ls *pdf | xargs -L1 -I{} echo 'echo {} && echo "CONFIDENTIAL - ATTN XYZ" | enscript -B -f Courier-Bold12 -o- | ps2pdf - | pdftk {} stamp - output tozip/{}' > stampit | |
chmod +x stampit |
see https://wiki.archlinux.org/index.php/GNOME_Keyring#SSH_keys
# list
$ ssh-add -L
# remove
$ ssh-add -D
kwparams = lambda kwargs, keys: (kwargs.get(k) for k in keys.split(','))
```
```
def foo(*args, **kwargs):
foo, bar = kwparams(kwargs, ('foo,bar'))
#!/usr/bin/env bash | |
# adopted from https://raw.githubusercontent.com/X1011/git-directory-deploy/master/deploy.sh | |
# | |
# changes | |
# * deploy from current directory is possible | |
# * set options from either .dzdeploy file or parameters | |
set -o errexit #abort if any command fails | |
source $(pwd)/.dzdeploy |
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://npmjs.org/install.sh | sh |
Sample run. Try yourself here
for any n >= 0
0 0 1 0
1 1 1 1
2 1 1 1
3 2 2 2
4 3 3 3
5 5 5 5
# convert database itself | |
# http://stackoverflow.com/a/6115705 | |
ALTER DATABASE db CHARACTER SET utf8 COLLATE utf8_unicode_ci; |