Skip to content

Instantly share code, notes, and snippets.

@nagy135
nagy135 / ssh-fzf
Last active August 13, 2021 13:48
#!/bin/bash
# Dependencies: https://github.com/junegunn/fzf
# Convenient way of selecting connection on terminal when often ssh-ing or copying files from other servers
declare -A conn_pairs
conn_pairs["hostname_DEV"]="vnagy@12.34.56.78"
conn_pairs["anotherhostname_STAGE"]="vnagy@87.65.44.32"
#!/bin/bash
type=$1
if [[ $type == 'python' ]]; then
# python shell dropdown
instance=$(xdotool search --classname python_dropdown)
if [[ $instance == '' ]]; then
#just open it if not running
#!/bin/bash
ICON="~/.scripts/resources/tmux.png"
if [[ $1 == 'kill' ]]; then
chosen=$(tmux ls | awk -F: '{print $1}' | rofi -theme "~/.config/rofi/tmux_warning.rasi" -dmenu -i -p 'Kill tmux session')
[[ ! -z $chosen ]] && notify-send -i $ICON -t 2000 "Tmux session killed" && alacritty --class toggle_tmux -e tmux kill-session -t "$chosen" &> /dev/null &
exit 0
elif [[ $1 == 'create' ]]; then
chosen=$(tmux ls | awk -F: '{print $1}' | rofi -theme input.rasi -dmenu -i -p 'Create tmux session')
#!/bin/zsh
wid=$1
class=$2
instance=$3
monitor=$4
desktop=$5
node=$6
if [[ "$class" == "mpv" ]]; then
#!/bin/zsh
wid=$1
class=$2
instance=$3
monitor=$4
desktop=$5
node=$6
if [[ "$class" == "mpv" ]]; then
#!/bin/zsh
wid=$1
class=$2
instance=$3
monitor=$4
desktop=$5
node=$6
if [[ "$class" == "mpv" ]]; then
@nagy135
nagy135 / .vimrc
Created August 1, 2019 18:41
vimrc
" ██╗ ██╗██╗███╗ ███╗██████╗ ██████╗
" ██║ ██║██║████╗ ████║██╔══██╗██╔════╝
" ██║ ██║██║██╔████╔██║██████╔╝██║
" ╚██╗ ██╔╝██║██║╚██╔╝██║██╔══██╗██║
" ╚████╔╝ ██║██║ ╚═╝ ██║██║ ██║╚██████╗
" ╚═══╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝
" Settings {{{
syntax on
filetype indent on
#!/bin/bash
thumbnail(){
wget -cq "https://i3.ytimg.com/vi/$1/hqdefault.jpg" -O ~/.scripts/resources/thumbnails/$1.jpg
# title=$(wget --quiet -O - "https://www.youtube.com/watch?v=$2" | paste -s -d " " | sed -e 's!.*<head>\(.*\)</head>.*!\1!' | sed -e 's!.*<title>\(.*\)</title>.*!\1!' | sed 's/\s*-\s*YouTube//')
}
viewer(){
alacritty --class subtube_viewer -e youtube-viewer &> /dev/null &
}
def brute_search( arr, score, my_min, path):
if len(arr) == 0:
return score, path
if my_min is None:
take, take_path = brute_search( arr[1:], 1, arr[0], [(1, arr[0])] )
ignore, ignore_path = brute_search( arr[1:], 0, None, [])
if take > ignore:
return take,take_path
else: