Skip to content

Instantly share code, notes, and snippets.

View Psycojoker's full-sized avatar
💭
I'm really busy right now, I can take weeks to answer.

Bram Psycojoker

💭
I'm really busy right now, I can take weeks to answer.
View GitHub Profile
@Psycojoker
Psycojoker / .zshrc
Created January 30, 2020 14:49
Bookmarking system for zsh
# put all _* files into ~/.zsh/completion/
j() {
mkdir -p ~/dotfiles/shell_bookmarks
if [ ! "$1" ]
then
echo "give me an alias as argument"
return
fi
[restart_service]
name = "Restart service"
command = "echo pouet $YNH_ACTION_SERVICE"
user = "root" # optional
cwd = "/" # optional
accepted_return_codes = [0, 1, 2, 3] # optional
description = "a dummy stupid exemple or restarting a service"
[restart_service.arguments]
[restart_service.arguments.service]
variables="\
YNH_CONFIG_FIRST_TAB_SECOND_SECTION_FIRST_OPTION
YNH_CONFIG_SECOND_TAB_POUET_FIRST_OPTION
YNH_CONFIG_SECOND_TAB_PASSWOWORD_FIRST_OPTION
YNH_CONFIG_SECOND_TAB_POUET_SECOND_OPTION
YNH_CONFIG_FIRST_TAB_FIRST_SECTION_FIRST_OPTION
YNH_CONFIG_FIRST_TAB_FIRST_SECTION_SECOND_OPTION\
"
config_path=/etc/yunohost/apps/${YNH_APP_ID}/stupid_config/
@Psycojoker
Psycojoker / check_outdated_dependencies.sh
Created May 2, 2019 12:42
checkout outdated dependencies with tox
#!/bin/bash
set -e
outdated_dependencies=$(pip list -o)
number_of_lines="$(echo -e "$outdated_dependencies" | grep "." | wc -l)"
if (( $number_of_lines > 0 ))
then
echo -e "$outdated_dependencies"
@Psycojoker
Psycojoker / .hgrc
Created March 8, 2019 15:50
Custom log command for mercurial
[revsetalias]
l = (parents(not public()) or not public() or . or head()) and (not obsolete()^) and not closed()
[templates]
l =\
{pad(label("commit.rev", rev), 5, " ", True)} \
{label("commit.hash", node|short)} \
{pad(label("changeset.{phase}", phase), 8)} \
{label("commit.date", pad(date|age, 15))}\
{label("commit.branch.{ifeq(branch, "default", "default", "other")}", pad(branch, 10))}\
#!/usr/bin/env python
import gimpfu
from gimpfu import pdb
def stickerify_bordure(image, tdrawable):
def duplicate_layer():
copy = current_layer.copy()
image.add_layer(copy)
@Psycojoker
Psycojoker / stuff.zsh
Last active July 16, 2018 19:41
Display possible video compressed size
possible_sizes() {
local video_path=$1
if [ ! "$video_path" ]
then
echo "Usage: possible_size video_path"
return
fi
local width=$(mediainfo $1 | grep Width | cut -d ":" -f 2 | sed 's/[^0-9]//g')
#!/bin/bash
BIN_PATH=ve/bin/git-of-theseus-analyze
if [ ! "$1" ]
then
echo "Usage: bash analyze.sh repos_list_file"
exit
fi
@Psycojoker
Psycojoker / finally.py
Created May 11, 2018 20:59
finally magic
def brol(fail=False):
try:
print "in try"
if fail:
raise Exception()
return "try"
except:
print "in exception"
return "exception"
finally:
@Psycojoker
Psycojoker / get_service.py
Created May 10, 2018 21:15
get all properties from a service from systemd using dbus (like "systemctl status $service")
import sys
import dbus
service = sys.argv[1]
d = dbus.SystemBus()
systemd = d.get_object('org.freedesktop.systemd1','/org/freedesktop/systemd1')
manager = dbus.Interface(systemd, 'org.freedesktop.systemd1.Manager')