I hereby claim:
- I am joaompinto on github.
- I am joaompinto (https://keybase.io/joaompinto) on keybase.
- I have a public key whose fingerprint is 44C9 EAAC D815 D09B 6121 C069 D146 43C2 83C8 DDD5
To claim this, I am signing this object:
#!/usr/bin/python3 | |
# Apply multiplier to duration string ('hh:mm') | |
# python3 multiply_duration.py 08:30 0.9 # 90% of a day | |
# python3 multiply_duration.py 08:30 5 # 5 days | |
import sys | |
def multiplty_duration(duration, multiplier): |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/python3 | |
from os import statvfs | |
from pprint import pprint | |
with open('/proc/mounts') as mounts_file: | |
mount_data = mounts_file.read().splitlines() | |
pprint(mount_data) | |
mount_points = map(lambda x: x.split()[1], mount_data) | |
for mount_path in mount_points: |
#!/bin/sh | |
udocker pull debian:stable-slim # ≃ 22MB | |
CID=$(udocker create --name=build debian:stable-slim) # ≃ 62MB | |
udocker run $CID << _EOF_ | |
apt-get update | |
apt-get upgrade | |
apt-get install -y gcc g++ bison bzip2 gawk make patch perl python3 texinfo # ≃ 351MB |
start: | |
- read from file list: www.openpipe.org/access* | |
- iterate: # Produce invididual elements | |
# Process any filed obtained from the file list | |
- read from file: | |
path: $_$ | |
mime_type: "text/plain" |
#!/usr/bin/expect -f | |
set target [lindex $argv 0]; | |
set timeout 60 | |
# Request the login password | |
stty -echo | |
send_user -- "Password for $target: " | |
expect_user -re "(.*)\n" |
TXT =""" | |
server.1 = something | |
server.2 = else | |
alone = testing | |
""" | |
def props2dict(config_data): | |
lines = config_data.splitlines() | |
lines = [l for l in lines if '=' in l] # Ignore non formatted lines |
Surviving on Windows with MSYS | |
If you are experienced Linux/Unix user you will get a bad time working on Windows, to my rescue comes MSYS which contains most of common utilities like tail, grep and friends. It does not require installation so it can be easily used from Windows servers. | |
Download the installer (mingw-get-*-bin.zip/ ) from: | |
http://sourceforge.net/projects/mingw/files/Installer/mingw-get/ | |
Extract mingw-get-*-bin.zip to C:\mingw_install | |
From the command line: | |
cd C:\mingw_install\bin | |
mingw-get.exe install msys-mintty msys-grep msys-base msys-openssh |
#!/bin/sh | |
# avoid duplicates.. | |
export HISTCONTROL=ignoredups:erasedups | |
# append history entries.. | |
shopt -s histappend | |
# After each command, save and reload history | |
export PROMPT_COMMAND="history -a; $PROMPT_COMMAND" | |
readonly PROMPT_COMMAND |
#!/bin/sh | |
LOGDIR=/var/log/nmon | |
/etc/init.d/nmon stop | |
find $LOGDIR -name "*.nmon" -mtime -mmin +10 -exec gzip {} \; | |
find $LOGDIR -name "*.nmon.gz" -mtime +90 -exec rm {} \; | |
/etc/init.d/nmon start |