Skip to content

Instantly share code, notes, and snippets.

View madprops's full-sized avatar

madprops madprops

View GitHub Profile
@madprops
madprops / netcheck.sh
Last active March 3, 2024 21:36
Bash script to check for network status
#!/usr/bin/env bash
status="down"
while true; do
ping -w 10 -c 1 8.8.8.8 > /dev/null 2>&1
ping_status=$?
if [ $ping_status -eq 0 ] && [ "$status" == "down" ]; then
timestamp=$(date +"%H:%M:%S")
#!/usr/bin/sh
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
export QT_QPA_PLATFORMTHEME=qt5ct
export XDG_SESSION_TYPE=x11
@madprops
madprops / png_to_jpg.sh
Last active August 20, 2023 23:04
Add this to a dolphin actions .desktop file
#!/usr/bin/env bash
input="$1"
output="${input%.*}.jpg"
counter=1
while [ -e "$output" ]; do
output="${input%.*}($counter).jpg"
counter=$((counter + 1))
done
@madprops
madprops / timer.rb
Last active July 19, 2023 09:28
Timer manager ruby script
#!/usr/bin/env ruby
require "open3"
# Get input information using rofi
def get_input(prompt, data)
cmd = "rofi -dmenu -p '#{prompt}' -i"
stdin, stdout, stderr, wait_thr = Open3.popen3(cmd)
stdin.puts(data)
stdin.close
return stdout.read.strip
@madprops
madprops / zshrc
Last active December 10, 2022 02:44
autoload -U colors && colors
PS1="%{$fg[green]%}%d%{$reset_color%} %{$fg[blue]%}$%{$reset_color%} "
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[3~" delete-char
alias get="sudo pacman -S"
alias update="sudo pacman -Syy"
@madprops
madprops / timer.rb
Created September 1, 2022 09:16
Script to start timers
#!/usr/bin/env ruby
require "open3"
# Get input information using rofi
def get_input(prompt, data)
cmd = "rofi -dmenu -p '#{prompt}'"
stdin, stdout, stderr, wait_thr = Open3.popen3(cmd)
stdin.puts(data)
stdin.close
return stdout.read.strip
@madprops
madprops / bckgit.py
Created August 9, 2022 01:27
Backup your public repos. Usernames/Orgs as arguments
import os
import sys
import requests
from pathlib import Path
def main():
usernames = sys.argv[1:]
for user in usernames:
userdir = Path(user)
import os
import sys
from pathlib import Path
# Main function
def main() -> None:
# Arguments
path = sys.argv[1]
if (len(sys.argv)) > 2:
@madprops
madprops / timer.py
Last active July 20, 2022 08:28
Start a timer using rofi
#!/usr/bin/env python
import re
import os
from sys import argv
from subprocess import Popen, PIPE
# Get input information using rofi
def get_input(prompt: str) -> str:
proc = Popen(f"rofi -dmenu -p '{prompt}'", stdout=PIPE, stdin=PIPE, shell=True, text=True)
@madprops
madprops / countrstring.sh
Created December 3, 2021 00:57
Show a message with the number of characters of the string in the clipboard
#!/bin/bash
string=$(xclip -o -sel clip)
numchars=$(echo -n "$string" | wc -c)
awesome-client "msg('$numchars')"