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
""" @file plot-examples.py | |
@brief ASCII-Plotter examples | |
@details Example usage of | |
[ASCII-Plotter](https://pypi.python.org/pypi/ASCII-Plotter/1.0), | |
with 1-D and 2-D examples each; | |
Currently you can obtain the aplotter.py file by | |
Imri Goldberg from | |
http://www.algorithm.co.il/blogs/ascii-plotter/ |
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 python3 | |
import getpass | |
from pasaffe_lib.readdb import PassSafeFile # should come with apt-get install pasaffe | |
pspass = getpass.getpass('pspass: ') | |
pf = PassSafeFile('/path/to/file.psafe3', pspass) | |
pf.get_all_folders() | |
# [['Folder 1'], ['Folder 2'], …] |
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 python3 | |
from itertools import islice | |
from find_conversations import read | |
class Census: | |
def __init__(self, represent=None): | |
self.data = {} | |
self.represent = represent |
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 | |
ETIKETT_PDF="dp-electroreturn_versandetikett.pdf" | |
OUT_PDF="${ETIKETT_PDF%.pdf}-multiplied.ps" | |
if ! [[ -e "$ETIKETT_PDF" ]]; then | |
echo please download it from https://www.deutschepost.de/de/e/electroreturn.html | |
else | |
pdftops "$ETIKETT_PDF" \ | |
&& pstops "0R(0,.5h)+0R(.5w,.5h)+0L(1w,.5h)+0L(.5w,.5h)" "${ETIKETT_PDF%.pdf}.ps" "${OUT_PDF%.pdf}.ps" \ | |
&& ps2pdf "${OUT_PDF%.pdf}.ps" \ | |
&& echo generated "$OUT_PDF" |
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 get_best(choice=range(1, 1080)): | |
'''Find best integer fit for the shorter side of Golden Ratio | |
Best fit has a integer-valued longer side with the smallest error to the real Golden Ratio | |
:param choice list(int): choioce of integers | |
>>> get_best() | |
(1.2018646489717657e-06, 305) | |
''' | |
return min((((x*(5**0.5)/2) % 1)/x, x) for x in choice) |
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 | |
[[ -n "$GOPATH" ]] || GOPATH="$HOME/gocode/bin" | |
PUP="$GOPATH/pup" | |
if ! [[ -e "$PUP" ]]; then | |
echo 'please install pup with' | |
echo 'GOPATH="$HOME/gocode" go get github.com/ericchiang/pup' | |
exit 1 | |
fi | |
# Aldi-Sued |
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 | |
[[ "$#" == 2 ]] || { | |
echo Please specify the two input PDF files. | |
exit 1 | |
} | |
PDF1="$1" | |
PDF2="$2" | |
PDFALL="all-$(date -I).pdf" | |
OUTPUTPDF="topcombine-${PDF1%.pdf}-$PDF2" |
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 | |
# see https://askubuntu.com/questions/276234/need-application-script-alerting-when-system-memory-is-running-out/346779#346779 | |
# add crontab -e the following: | |
# * * * * * DISPLAY=:0.0 /path/to/memwarn.bash | |
#Minimum available memory limit, MB | |
if [[ -n "$1" ]]; then | |
THRESHOLD="$1" | |
else | |
THRESHOLD=400 |
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 -*- | |
expect_at = 2**22 | |
plants = expect_at * ['wind'] + ['solar'] + expect_at * ['biogas'] | |
repetitions = 100 | |
def where_is_eafp(target): | |
try: |
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 Tool(name): | |
data = { | |
'name': name, | |
'size': 0, | |
'color': 0xffee88, | |
} | |
def get_color(): | |
return data['color'] | |
OlderNewer