Skip to content

Instantly share code, notes, and snippets.

View stelcodes's full-sized avatar
🏠
Working from home

Stel Abrego stelcodes

🏠
Working from home
View GitHub Profile
@stelcodes
stelcodes / backup-directory-dangerously.clj
Created October 1, 2022 03:18
safely use rsync --archive --delete to backup a directory
#!/usr/bin/env bb
(ns backup-directory-dangerously
(:require [babashka.cli :as cli]
[babashka.fs :as fs]
[babashka.process :as p]
[clojure.java.io :as io]
[clojure.string :as str]))
(defn abort []
(println "Aborting backup")
@stelcodes
stelcodes / backup-directory-dangerously.fish
Last active October 1, 2022 03:16
fish function for safely using rsync --archive --delete to backup a directory
function backup-directory-dangerously
read --function --prompt-str "source directory: " --shell source_dir
if test ! -d $source_dir
echo "source is not a directory"
echo "aborting backup duplication"
return 1
end
set --function source_dir $(readlink -f $source_dir)
read --function --prompt-str "overwrite directory: " --shell overwrite_dir
@stelcodes
stelcodes / cycle-sink.clj
Last active September 29, 2022 05:09
babashka pactl cycle default sink
#!/usr/bin/env bb
(ns cycle-sink
(:require [babashka.process :as p]
[clojure.pprint :as pp]
[clojure.string :as str]))
(defmacro debug [sym] `(do (println ~(keyword sym)) (pp/pprint ~sym) (println)))
(def sinks
(let [default-sink-name (->> (p/sh ["pactl" "info"])
@stelcodes
stelcodes / glow style.json
Created October 7, 2021 22:50
glow nord style - wip
{
"document": {
"block_prefix": "\n",
"block_suffix": "\n",
"color": "#d8dee9",
"margin": 2
},
"block_quote": {
"indent": 1,
"indent_token": "│ "
@stelcodes
stelcodes / init.vim
Created September 29, 2021 02:15
My neovim config as of 9-28-21
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugins
call plug#begin()
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-obsession'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-projectionist'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive'
@stelcodes
stelcodes / bb-postgresql-backup-restore.edn
Last active July 1, 2022 05:20
Babashka Tasks for PostgreSQL Backups
; run `bb backup` to backup database
; run `bb restore` to restore latest backup
{:min-bb-version "0.4.0",
:tasks {; CONSTANTS
db-name "dev_blog",
backup-dir "backups",
now (str (java.time.LocalDateTime/now)),
; TASKS
create-backup-dir {:depends [backup-dir], :task (babashka.fs/create-dirs backup-dir)},
@stelcodes
stelcodes / bb-passing-args-example-script.clj
Last active May 27, 2021 21:14
Babashka passing arguments example script
#!/usr/bin/env bb
;; Replicating bash/zsh "<command> $@" in babashka
(require '[babashka.process :refer [process tokenize]])
(def command "java -jar /deploy/zprint/zprint.jar")
(as-> command $
(tokenize $)
(concat $ *command-line-args*)
(do @(process $ {:inherit true}) nil))
@stelcodes
stelcodes / userChrome.css
Last active December 21, 2021 12:56
Rounded tabs for Firefox + Nord color theme
/* Adapted from https://github.com/wilfredwee/photon-australis/blob/master/userChrome-dark.css */
/* Works for Firefox 89 and later */
/* Pair with the offical Nord color theme: https://addons.mozilla.org/en-US/firefox/addon/nord-theme */
/* This file should be located at ~/.mozilla/firefox/<profile-dir>/chrome/userChrome.css */
/* Simply restart Firefox and the css should load */
:root {
--tab-curve-width: 30px;
--tabs-border: transparent !important;
--tab-border-radius: 0 !important;
@stelcodes
stelcodes / Using Git to Manage a Live Web Site.md
Last active February 8, 2018 22:32 — forked from Nilpo/Using Git to Manage a Live Web Site.md
Using Git to Manage a Live Web Site

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents