Skip to content

Instantly share code, notes, and snippets.

Avatar

Yurizal Susanto yursan9

View GitHub Profile
@yursan9
yursan9 / generic_handler.go
Created Dec 14, 2021
Golang Handler using generics
View generic_handler.go
package main
import (
"fmt"
"net/http"
)
type HandlerFunc[T, V any] func(data T, r *http.Request, rw http.ResponseWriter) (V, error)
type BindFunc[T any] func(r *http.Request) T
@yursan9
yursan9 / monitor-mpris
Created May 12, 2019
Simple script to monitor media player status and currently song
View monitor-mpris
#!/usr/bin/env bash
# Change player variable to the name of your media player. E.g. vlc or spotify.
player='rhythmbox'
iface='org.mpris.MediaPlayer2'
dest="$iface.$player"
obj='/org/mpris/MediaPlayer2'
props=`gdbus introspect --session --dest $dest --object-path $obj --only-properties`
View hellobudgie.plugin
[Plugin]
Loader=python3
Module=hellobudgie
Name=Python Sample Applet
Description=Python Sample Applet
Authors=Yurizal Susanto
Copyright=Copyright © 2019 Yurizal Susanto
Website=https://getsol.us
Icon=user-desktop-symbolic
@yursan9
yursan9 / tag-music
Created Mar 2, 2019
Simple scripts for tagging audio file using mutagen
View tag-music
#!/usr/bin/fish
function print_help
printf "\n%s\n" "Usage: tag-music [options] [filename]"
printf "\n%s\n" "Options:"
printf "%s\t%s\n" "-h, --help" "Show this help message and exit"
printf "%s\t%s\n" "-e, --edit" "Edit the tag, use the preexisting values if available"
end
@yursan9
yursan9 / config.fish
Last active Jan 30, 2018
A command to make new package easier for Solus Packager using Fish
View config.fish
alias fetchyml="$HOME/Repository/common/Scripts/yauto.py"
alias updateyml="/usr/share/ypkg/yupdate.py"
function neweopkg -a directory url -d "Create directory for new eopkg package"
mkdir $directory
if test $status = 0
cd $directory
echo "include ../Makefile.common" > Makefile
fetchyml $ur
end