Skip to content

Instantly share code, notes, and snippets.

View yursan9's full-sized avatar

Yurizal Susanto yursan9

  • BIT
  • Tangerang, Indonesia
  • 05:45 (UTC +07:00)
View GitHub Profile
@yursan9
yursan9 / generic_handler.go
Created December 14, 2021 12:28
Golang Handler using generics
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 07:30
Simple script to monitor media player status and currently song
#!/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`
[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 March 2, 2019 03:48
Simple scripts for tagging audio file using mutagen
#!/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 January 30, 2018 14:03
A command to make new package easier for Solus Packager using 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