Skip to content

Instantly share code, notes, and snippets.

View m42e's full-sized avatar

Matthias Bilger m42e

View GitHub Profile
#include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string line;
for line in open('Kontaktliste.txt', 'r').readlines():
fn, s, p, c, t, e = map(str.strip, line.split(','))
a = f"{s}\\n{p} {c}"
v, n = fn.split(' ')
vcf=f"""
BEGIN:VCARD
VERSION:3.0
N;CHARSET=UTF8:{n};{v};;;
#!/usr/bin/env zsh
#
#
local PLANTUML_TOOL_FILE
local PLANTUML_DOWNLOAD_URL
PLANTUML_TOOL_FILE=~/.dotfiles/tools/plantuml.jar
PLANTUML_DOWNLOAD_URL=http://sourceforge.net/projects/plantuml/files/plantuml.jar/download
_plantuml_download_if_needed(){
if [ ! -f ${PLANTUML_TOOL_FILE} ]; then
@m42e
m42e / fzf-ssh.zsh
Last active June 2, 2019 06:35 — forked from dohq/fzf-ssh.zsh
fzf-ssh
function _resolv_ssh_hosts () {
local CURRENTFILE
eval CURRENTFILE=$1
local selectedhosts=$(grep "Host " ${CURRENTFILE} | grep -v '*' | cut -b 6-)
local includes=$(grep "Include " ${CURRENTFILE} | cut -b 9-)
for inc in ${(@f)includes}; do
selectedhosts+=$(_resolv_ssh_hosts $inc)
done
echo $selectedhosts
}
@m42e
m42e / PyLoadiOSPush.py
Created June 21, 2016 04:26
PyLoadiOS fix
from module.plugins.internal.Addon import Addon
import httplib, urllib
class PyLoadiOSPush(Addon):
__name__ = "PyLoadiOSPush"
__type__ = "hook"
__version__ = "1.1"
__description__ = "Push for pyLoad for iOS App"
__config__ = [("deviceKey", "str", "Device Keys (comma seperated)", ""),
@m42e
m42e / FileSidebar.py
Last active August 29, 2015 14:14
File Sidebar For Pythonista
import keychaindb, ui, editor, os
class FileBarEntry (object):
def __init__(self, filename, open, delete):
self.filename = filename
self.open = open
self.delete = delete
class FileSidebar(object):
def __init__(self):
@m42e
m42e / save_script.py
Created January 27, 2015 03:50
save_script.py
''' This script allows you to copy a .py script to the iOS clipboard and then use Open In...
to have that script saved in Pythonista. This requires both the Workflow and Pythonista apps
and the workflow at https://workflow.is/workflows/8cdee57f79664205a6a565c9cbdb3d48 '''
import clipboard
import console
import os
import sys
def save(filename, text, ext):
import photos
import clipboard
import webbrowser
img = photos.pick_image(include_metadata=True)
meta=img[1]
gps = meta.get('{GPS}')
<?
$login = 'yourlogin';
$apikey = 'yourapikey';
$url = $_GET['URL4BITLY'];
/* make a URL small */
function make_bitly_url($url,$login,$appkey,$format = 'xml',$version = '2.0.1')
{
@m42e
m42e / gist:2d1fce8dd993a95e5439
Created January 2, 2015 15:33
GET2POST in PHP
<?
$url = $_GET['URL2GO'];
unset($_GET['URL2GO']);
$data = $_GET;
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),