Skip to content

Instantly share code, notes, and snippets.

View koonix's full-sized avatar
🦆
honk

koonix

🦆
honk
View GitHub Profile
@koonix
koonix / mount-mtp.sh
Last active July 1, 2021 10:25
[Bash Script] Mount and open android phones automatically. Uses simple-mtpfs(1).
#!/bin/sh
# this script looks for connected android or MTP devices
# for 30 seconds, and mounts them when connected.
# if any device is already mounted, it just opens them.
# requires simple-mtpfs(1).
# config
mnt=~/Mount/MTP
file_manager="${FILE:-xdg-open}"
@koonix
koonix / live-wallpaper.sh
Last active February 17, 2022 20:32
Set live wallpapers on linux.
#!/bin/sh
# soystemd 2021-04-10 (https://github.com/soystemd)
# sets a video or gif as your wallpaper.
# requires mpv, xwinwrap and xrandr.
# to kill the live wallpaper, just run this with no arguments.
#
# example:
# $ live video.mp4
#
# for killing:
@koonix
koonix / mount-adb.sh
Last active May 23, 2021 15:53
[Bash Script] Mount android phones via ADB on linux.
#!/bin/bash
# access the storage of android devices
# through adb via adbfs.
# requires adbfs-rootless.
# config
mnt=~/Mount/ADB
main () {
while true; do
@koonix
koonix / mpvmusic.sh
Last active January 3, 2022 17:50
Play music in terminal via mpv.
#!/bin/sh
clear -x; tput civis # hide cursor
mpv \
--audio-display=no --term-osd-bar --force-window=no \
--keep-open=yes --display-tags-clr --term-title='mpv' \
--msg-level=cplayer=error,ffmpeg=fatal,ffmpeg/demuxer=error \
--term-status-msg='File: ${filename}\n\nTitle: ${metadata/by-key/title}\nArtist: ${metadata/by-key/artist}\nAlbum: ${metadata/by-key/album}\n\n${!playlist-count==1:Playing ${playlist-pos-1}/${playlist-count}\n}${?pause==yes:(Paused) }${time-pos} / ${duration}' \
--term-osd-bar-chars='[-> ]' "$@"
tput cnorm # cursor back to normal
@koonix
koonix / watchusb.sh
Last active July 1, 2021 10:24
Watch connected usb devices on linux.
#!/bin/sh
# show a cleaned-up output of lsusb periodically. requires usbutils.
watch --differences --no-title --interval 0.5 "lsusb | grep -vi 'root hub$'"
@koonix
koonix / mount-ftp.sh
Last active July 1, 2021 10:26
[Bash Script] Mount FTP servers from a list of servers.
#!/bin/bash
# mount ftp servers from a server list.
# i use it to mount my phone with the
# help of an ftp server android app.
# requires curlftpfs.
# config
hosts=~/.config/mftp/hosts
mntdir=~/Mount/FTP
@koonix
koonix / swallow-tmux.diff
Last active April 3, 2022 07:22
A modified version of dwm's swallow patch that works with tmux.
A modified version of dwm's swallow patch that works with tmux.
Based on: https://dwm.suckless.org/patches/swallow/dwm-swallow-20201211-61bb8b2.diff
Hosted at: https://gist.github.com/soystemd/0ac35d048672c63d7fc3afb1fde4c5f2
---
diff --git a/config.def.h b/config.def.h
index a2ac963..f833d23 100644
--- a/config.def.h
+++ b/config.def.h
@koonix
koonix / mtp-automount.sh
Last active July 1, 2023 18:22
Automount android phones. Uses go-mtpfs.
#!/bin/sh
# this script mounts and opens any connected mtp devices while it's running.
# requires go-mtpfs, moreutils , fuse and udev.
# config
cache="${XDG_CACHE_HOME:-$HOME/.cache}/mtpd"
tmp="${XDG_RUNTIME_DIR:-/tmp}/mtpd"
main()
{
@koonix
koonix / progressbar.lua
Created February 13, 2022 12:47
Unicode Progress Bar in Lua.
-- lua code for generating a nice unicode progress bar.
-- author: Ehsan Ghorbannezhad <ehsan at disroot dot org>
-- input percentage
PERCENT = 96
function round(n)
return math.floor(n+0.5)
end
@koonix
koonix / circumvent.sh
Last active February 27, 2022 21:02
a script to download, configure and start the psiphon proxy client.
#!/bin/sh
# download, configure and start the psiphon proxy client.
# requires curl, aria2, libnotify (optional).
# Config
# ==========
# ports
SOCKS_PORT=9050
HTTP_PORT=8585
#