Skip to content

Instantly share code, notes, and snippets.

View webflo-dev's full-sized avatar

Florent webflo-dev

View GitHub Profile
@webflo-dev
webflo-dev / alttab
Created February 14, 2022 16:01 — forked from SidharthArya/alttab
Sway Windows Manager Alt Tab behavior
#!/usr/bin/env python3
import sys
import json
import subprocess
direction=bool(sys.argv[1] == 't' or sys.argv[1] == 'T')
swaymsg = subprocess.run(['swaymsg', '-t', 'get_tree'], stdout=subprocess.PIPE)
data = json.loads(swaymsg.stdout)
current = data["nodes"][1]["current_workspace"]
#!/bin/sh
# TODO: If using --criteria on a window in another workspace, sway switches to that workspace
USAGE="\
${0} [--id|--criteria] <index|id|criteria>
Focus/hide the container at <index> in the scratchpad
Depends:
jq
Args:
@webflo-dev
webflo-dev / backup.sh
Last active June 15, 2022 13:23
backup gnome archlinux
#!/usr/bin/env bash
date=$(date +"%Y-%m-%d")
source_dir=/home/$USER/
backup_dir=${source_dir}backup_${date}/
mkdir -p ${backup_dir}
dconf dump / > gnome_dconf.conf
tar -zcvf ${backup_dir}gnome_extensions.tar.gz ${source_dir}.local/share/gnome-shell/extensions/
function multiselect {
# little helpers for terminal print control and key input
ESC=$( printf "\033")
cursor_blink_on() { printf "$ESC[?25h"; }
cursor_blink_off() { printf "$ESC[?25l"; }
cursor_to() { printf "$ESC[$1;${2:-1}H"; }
print_inactive() { printf "$2 $1 "; }
print_active() { printf "$2 $ESC[7m $1 $ESC[27m"; }
get_cursor_row() { IFS=';' read -sdR -p $'\E[6n' ROW COL; echo ${ROW#*[}; }
@webflo-dev
webflo-dev / winget-apps.json
Last active December 16, 2021 12:03
winget install
{
"$schema" : "https://aka.ms/winget-packages.schema.2.0.json",
"CreationDate" : "2021-12-16T13:02:46.391-00:00",
"Sources" :
[
{
"Packages" :
[
{
"PackageIdentifier" : "Bitwarden.Bitwarden"
@webflo-dev
webflo-dev / envup.sh
Created September 19, 2021 10:42
Load env file
envup() {
local file=$([ -z "$1" ] && echo ".env" || echo ".env.$1")
if [ -f $file ]; then
set -a
source $file
set +a
else
echo "No $file file found" 1>&2
return 1
/** Operators */
const map = (mapper) => (reducer) => (acc, val) => reducer(acc, mapper(val));
const filter = (predicate) => (reducer) => (acc, val) =>
predicate(val) ? reducer(acc, val) : acc;
const some = (predicate) => (_) => (acc, val) =>
acc !== true ? predicate(val) : true;
/** */
@webflo-dev
webflo-dev / manjaro-aur-packages.sh
Last active September 30, 2021 17:01
manjaro setup
pamac build direnv
flatpak install spotify
pamac build microsoft-edge-dev-bin
pamac build visual-studio-code-bin
@webflo-dev
webflo-dev / pacman.md
Last active August 4, 2021 07:16
archlinux - pacman