Skip to content

Instantly share code, notes, and snippets.

import json
import sys
import mistune
import re
origin_text = open(sys.argv[1],"r").read()
origin_json = json.loads(origin_text)
users_podurl = 'https://'+re.findall('@([^@]+)',origin_json['user']['profile']['diaspora_handle'])[0]
@DeusFigendi
DeusFigendi / diaspora_profile_stats.py
Created July 11, 2017 10:55
This python script generates some stats about your diaspora profile. Usage: python diaspora_profile_stats.py profile_export_file.json
import json
import os
from datetime import datetime
import collections
import unicodedata
import sys
profile_fh = open(sys.argv[1],'r')
profile_tx = profile_fh.read()
profile_dc = json.loads(profile_tx)
@DeusFigendi
DeusFigendi / reduce_image_size.py
Created May 4, 2019 15:10
Reduces size of all files in the working directory
from __future__ import print_function
import os, sys
import shutil
from PIL import Image
file_list = os.listdir("./")
target_size = 4000*1024
start_quality = 95
current_quality = 95
@DeusFigendi
DeusFigendi / random_fediverse_service.py
Created May 4, 2019 15:12
Selects three random projects from the-federation.info
import random
list_of_projects = ["Mastodon","Pleroma","PeerTube","Matrix (Synapse)","diaspora*","Write Freely","Friendica","Hubzilla","PixelFed","Misskey","WordPress","ActivityRelay","Funkwhale","Plume","GNU social","Osada","unknown","Socialhome","zap","Prismo","microblogpub","GangGo","redmatrix","Seattle relay","read.as","booth","matrix|construct","rustodon","reel2bits","p3k","red_platform","red","Juick","speechmore","Social Relay","smilodon","koype","pubgate"]
print(random.choice(list_of_projects))
print(random.choice(list_of_projects))
print(random.choice(list_of_projects))
@DeusFigendi
DeusFigendi / morse-code.json
Created February 8, 2020 07:32 — forked from mohayonao/morse-code.json
morse-code.json
{
"-": "t",
​"--": "m",
​"---": "o",
​"-----": "0",
​"----.": "9",
​"---..": "8",
​"--.": "g",
​"--.-": "q",
​"--..": "z",
@DeusFigendi
DeusFigendi / KMLbluepushpin.svg
Created July 14, 2020 15:56
For OpenTracks…
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DeusFigendi
DeusFigendi / paclientbind.py
Last active April 7, 2021 20:03
This python3 script randomly chooses an output device and tells pulse audio to bind ALL the outputs from all the programs to that device.
#!/usr/bin/python3
import subprocess
import random
# get a list of all available sinks (output-devices)
get_the_sinks = subprocess.check_output(["pactl", "list", "short", "sinks"]).decode('utf-8').split("\n")
list_of_sinks = []
for outputline in get_the_sinks:
this_sink_listing = outputline.split("\t")
@DeusFigendi
DeusFigendi / randomlocation_list.md
Created July 8, 2021 17:17
Dieses Dokument sammelt die Veröffentlichungen, die ich im Rahmen von #randomlocation so gemacht habe.
  graph TD;
      Aufgabe-->Angreifen;
      Angreifen-->Waffe_wählen-->Ziel_wählen[Ziel wählen, Ziel_verletzt?];
      Ziel_wählen-- Ja -->Zielverletzt[Irgendwas mit Bedrohung +1];
      Ziel_wählen-- Nein -->tödlicher_Angriff_festlegen[Bestimmen ob der Angriff tötlich sein soll];
      Zielverletzt-->tödlicher_Angriff_festlegen;
      tödlicher_Angriff_festlegen-- Ja -->Angriff_ist_tödlich[+1 Bedrohung];
      tödlicher_Angriff_festlegen-- Nein -->FernOderNah[Nahkampf oder Fernkampf?];
      Angriff_ist_tödlich-->FernOderNah;