Skip to content

Instantly share code, notes, and snippets.

View Pablo1107's full-sized avatar

Pablo Andres Dealbera Pablo1107

View GitHub Profile
@Pablo1107
Pablo1107 / flake.nix
Created June 30, 2023 02:38
Example Nix Develop with Flake
{
description = "example-nix-develop";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a";
};
outputs = { self, nixpkgs }:
let
# System types to support.
@Pablo1107
Pablo1107 / README.md
Created June 3, 2023 20:24
Setup gvfs to work with Nautilus in Non-NixOS using Home Manager

Installing Nautilus directly from Nixpkgs in Non-NixOS systems have no support for mounting sftps and other features that needs gvfs.

The solution for this is to install gnome3.gvfs in your packages list and then setup the env variable like this:

home.packages = with pkgs; [
  gnome3.gvfs
  gnome3.nautilus
];
@Pablo1107
Pablo1107 / in2csv.py
Last active April 9, 2022 15:18
Import coinbase pro transactions to hledger with capital gains using average cost basis method
import sys
import csv
import pprint
import datetime as dt
import json
import pathlib
pp = pprint.PrettyPrinter(indent=4)
CBP_PATH = pathlib.Path(__file__).parent.resolve()
@Pablo1107
Pablo1107 / cb2in.py
Created April 9, 2022 14:09
Automatic import/fetch coinbase and coinbase pro transactions csv and hledger rules
#!/usr/bin/env python3
import sys
import requests
import datetime as dt
import pathlib
import csv
import requests_cache
expire_after = dt.timedelta(days=3)
session = requests_cache.CachedSession(cache_name='cache', backend='sqlite', expire_after=expire_after)
@Pablo1107
Pablo1107 / .ctags
Created May 17, 2020 21:03 — forked from briemens/.ctags
ctags config for javascript, (s)css, html, clojure, etc
--langmap=javascript:.js.es6.es.jsx
--javascript-kinds=-c-f-m-p-v
--regex-javascript=/^[ \t]*var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\[/\1/A,Array,Arrays/b
--regex-javascript=/^[ \t]*let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\[/\1/A,Array,Arrays/b
--regex-javascript=/^[ \t]*const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\[/\1/A,Array,Arrays/b
--regex-javascript=/^[ \t]*var[ \t]\{1,\}\([A-Z][A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*function/\1/C,Class,Classes/b
--regex-javascript=/^[ \t]*let[ \t]\{1,\}\([A-Z][A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*function/\1/C,Class,Classes/b
--regex-javascript=/^[ \t]*const[ \t]\{1,\}\([A-Z][A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*function/\1/C,Class,Classes/b
@Pablo1107
Pablo1107 / Local PR test and merge.md
Created May 17, 2020 18:59 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@Pablo1107
Pablo1107 / newscript.sh
Created May 4, 2020 20:21 — forked from aaronNGi/newscript.sh
Boilerplate for new POSIX shell scripts
#!/bin/sh
prog_name=${0##*/}
version=1.0
version_text="Boilerplate for new scripts v$version"
options="h o: q v V"
help_text="Usage: $prog_name [-o <text>] [-hqvV] [<file>]...
Boilerplate for new scripts

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

function! GetColorFromHighlightGroup(group, color, env)
return synIDattr(synIDtrans(hlID(a:group)), a:color, a:env)
endfunction
function! GetBackgroundColors(group)
return
\ ' ctermbg=' . GetColorFromHighlightGroup(a:group, 'bg', 'cterm') .
\ ' guibg=' . GetColorFromHighlightGroup(a:group, 'bg', 'gui')
endfunction
@Pablo1107
Pablo1107 / mpc-fade
Last active September 8, 2023 20:24
A script to fade volume when toggling MPD via mpc based on lcpz's script.
#!/bin/sh
# A script to fade volume when toggling MPD via mpc
mpc=`which mpc`
SINKAPP="mpd"
SECS=2.0
sinks=$(pactl list sink-inputs)