Skip to content

Instantly share code, notes, and snippets.

View cirrusUK's full-sized avatar
💭
Dunroamin, Duncarin, Dunlivin.

cirrus cirrusUK

💭
Dunroamin, Duncarin, Dunlivin.
View GitHub Profile
@cirrusUK
cirrusUK / fo
Created October 19, 2020 21:35
#!/bin/zsh
export DISPLAY=":0"
export XDG_RUNTIME_DIR=/run/user/$(id -u)
IFS=$'\n'
out=("$(rg --files --hidden | fzf --ansi -m --color dark,hl:172,hl+:46,fg+:26,bg+:235 --color info:150,prompt:26,spinner:150,pointer:26,marker:7,border:26 --border=sharp --prompt='➤ ' --pointer='➤ ' --marker='➤ ' --height 60% --expect=ctrl-o,ctrl-e )")
key=$(head -1 <<< "$out")
file=$(head -2 <<< "$out" | tail -1)
if [ -n "$file" ]
then
[ "$key" = ctrl-o ] && open "$file" || ${EDITOR:-vim} "$file"
#!/bin/sh
dir=("$HOME"/video)
get_selection() {
for p in $dir; do
ls "$p"
done \
| fzf --ansi --height 80% --color fg:-1,bg:-1,hl:4,fg+:3,bg+:233,hl+:4 --color info:150,prompt:3,spinner:150,pointer:3,marker:174,border:11 --border=sharp --prompt='➤ ' --exit-0
}
#!/usr/bin/env python3
# Based on code from these stackoverflow answers:
# https://askubuntu.com/questions/60837/record-a-programs-output-with-pulseaudio/910879#910879
# pulse-recorder.py -i --encoder "lame -r -q 3 --lowpass 17 --abr 192 - '%s'" -o '~/Music/"${RANDOM}".mp3'
import re
import subprocess
import sys
import os
import signal
from time import sleep
#define player
player=mpv --cache=5000
#try these stream qualitys
default-stream=worst,480p,best,high,low,720p
# Number of threads to use when streaming HLS streams
hls-segment-threads=2
# Number of threads to use when streaming HDS streams
hds-segment-threads=2
stream-segment-threads=3
# Use this option to let the player stay or close itself instead.
@cirrusUK
cirrusUK / htoprc
Created October 1, 2020 23:06
rc file for htop
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 46 47 1
sort_key=46
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=0
show_thread_names=0
#!/bin/bash
export DISPLAY=":0"
export XDG_RUNTIME_DIR=/run/user/$(id -u)
while true; do free | grep Mem | awk '{print $3/$2 * 100.0}'; sleep 1; done | osd_cat --align right --pos bottom -o 50 --lines 1 --delay 2 -f '-*-envy code r-*-*-*-*-24-*-*-*-*-*-*-*' -c orange & while true; do top -b -n1 | grep "Cpu(s)" | awk '{print $2 + $4}'; sleep 1; done | osd_cat --align right --pos bottom --lines 1 --delay 2 -f '-*-envy code r-*-*-*-*-24-*-*-*-*-*-*-*' -o 20 -c orange
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
/*
MIT License
Copyright (c) 2014 Christian Weyer
#!/bin/sh
# install AUR packages with cower
cd $HOME/build/aur && cower -d "$1"
builddir="$_"
cd "$builddir" && ${EDITOR:-nano} PKGBUILD
makepkg -sirc && cd - &>/dev/null
read -p "Remove Build directory? [Y/n]? " yn
@cirrusUK
cirrusUK / bashfan
Created May 30, 2020 19:57
shell script to control fan settings on thinkpad (x220)
#!/bin/bash
# (1) prompt user, and read command line argument
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
printf %"s\n"
printf %"s\n"
tput setaf 3
blue=`tput setaf 4`