Skip to content

Instantly share code, notes, and snippets.

@djvs
djvs / move_workspace_to_edge.js
Last active April 9, 2021 18:19
sway script - align focused window to given side of focused workspace
const c = require("child_process")
const workspaces = JSON.parse(
c.execSync("swaymsg -t get_workspaces", { encoding: "utf8" })
)
const ws = workspaces.find((x) => x.focused)
const win = ws.floating_nodes.find((x) => x.focused)
@djvs
djvs / youtube-playlist-split.rb
Last active December 12, 2020 22:11
Script to break down YouTube playlist audio into separate files per-track, based on YouTube description/comment track lists. Depends on commandline ffmpeg
#!/usr/bin/env ruby
require 'shellwords'
require 'open3'
require 'pry-rails'
if ARGV.length < 2
case ARGV[0]
when nil, "--help"
puts "Usage: youtube-playlist-split.rb AUDIO_FILE PLAYLIST_FILE
@djvs
djvs / crypto_report.rb
Last active January 5, 2018 03:17
Cryptocurrency holdings snapshot report generator via coinmarketcap.com API (requires pry and curb gems)
#!/usr/bin/env ruby
#
require 'date'
require 'json'
require 'curb'
require 'pry'
puts "Report generated #{DateTime.now.strftime("%Y-%m-%d at %I:%M %p %z")}"
puts
select
(count(*) filter (where confirmed) * 100.0 / nullif(count(*),0) )
from foobar;
$ cabal update
Config file path source is default config file.
Config file /home/d/.cabal/config not found.
Writing default configuration to /home/d/.cabal/config
Downloading the latest package list from hackage.haskell.org
$ cabal install MissingH xmonad xmonad-contrib xmonad-utils taffybar gtk2hs-buildtools
Resolving dependencies...
Downloading X11-1.8...
Downloading blaze-builder-0.4.0.2...
$ cabal install MissingH xmonad xmonad-contrib xmonad-utils taffybar gtk2hs-buildtools
hResolving dependencies...
Downloading data-default-instances-containers-0.0.1...
Downloading data-default-instances-dlist-0.0.1...
Configuring hashtables-1.2.1.1...
Configuring data-default-instances-dlist-0.0.1...
Downloading data-default-instances-old-locale-0.0.1...
Jack Collom's "12-21-94"
Crazy writings on the mottled, lighted sky,
Romantic slate, are trees, bare, ruined choirs
Perhaps but also branch essentials. Why
Question their configures, their live wires
To us all, this morning? Sheer potential
Holds the sky in fragments - actualized
EBEGAE capo 2
E -----------------------------------------2-------------------------------------------------------------------------------------------------------------------
A ---------0---------------0-----------------0-----------------------------------------------------------------------------------------------------------------
G#------0----0---0------0---0--0------0--------0--------------------------------------------------------------------------------------------------------------
E -------0-----0---------0---0----------0--------0-------------------------------------------------------------------------------------------------------------
B ----2---------------2-------------2--------------------------------------------------------------------------------------------------------------------------
E --2---------------2-------------0---------------------
-- Compiler flags --
{-# LANGUAGE NoMonomorphismRestriction, FlexibleInstances, MultiParamTypeClasses, TypeSynonymInstances, FlexibleContexts #-}
-- Imports --
-- stuff
import XMonad
import Control.Monad (msum, when)
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Exit
-- Compiler flags --
{-# LANGUAGE NoMonomorphismRestriction #-}
-- Imports --
-- stuff
import XMonad
import Control.Monad (msum, when)
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Exit