Skip to content

Instantly share code, notes, and snippets.

View miraculixx's full-sized avatar
💭
working on https://github.com/omegaml

miraculixx

💭
working on https://github.com/omegaml
  • Switzerland
View GitHub Profile
@miraculixx
miraculixx / gettox
Last active August 29, 2015 14:13
Get tox on debian Linux
#!/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"
@miraculixx
miraculixx / editor
Created January 31, 2015 09:50
eclipse pydev editor settings
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
@miraculixx
miraculixx / tipstricks.md
Created January 31, 2015 20:02
tastypie ticks and tricks
  • 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:
@miraculixx
miraculixx / crstampit
Last active August 29, 2015 14:14
create stamps on PDFs
# 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
@miraculixx
miraculixx / tips.md
Created February 7, 2015 11:51
linux tips and tricks
@miraculixx
miraculixx / tips.md
Last active August 29, 2015 14:15
python tips and tricks
  • terse parse for keyword arguments
kwparams = lambda kwargs, keys: (kwargs.get(k) for k in keys.split(','))
```

```
def foo(*args, **kwargs): 
    foo, bar = kwparams(kwargs, ('foo,bar'))
    
@miraculixx
miraculixx / gitdeploy
Last active August 29, 2015 14:15
git deploy from current subdirectory
#!/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
@miraculixx
miraculixx / README.md
Last active August 29, 2015 14:15
fun with the fibonacci sequence. implemented off the top of my head. (and you thought I didn't know @“#)

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
@miraculixx
miraculixx / database.sql
Last active August 29, 2015 14:17
reset mysql db to utf8
# convert database itself
# http://stackoverflow.com/a/6115705
ALTER DATABASE db CHARACTER SET utf8 COLLATE utf8_unicode_ci;