Skip to content

Instantly share code, notes, and snippets.

@muness
muness / am-obsidian.user.js
Last active October 12, 2022 13:37
Add Obsidian Links next to Amazing Marvin tasks
// ==UserScript==
// @name Add Obsidian Links in Amazing Marvin
// @namespace https:/217castle.com
// @updateURL https://gist.githubusercontent.com/muness/3741bfa2afa5e58d38a420c50cefaa38/raw/am-obsidian.user.js
// @downloadURL https://gist.githubusercontent.com/muness/3741bfa2afa5e58d38a420c50cefaa38/raw/am-obsidian.user.js
// @version 0.1.3
// @author Muness Castle
// @description In Amazing Marvin, this script finds Wiki links and adds links to Obsidian
// @require https://cdn.jsdelivr.net/gh/CoeJoder/waitForKeyElements.js@v1.2/waitForKeyElements.js
// @match https://app.amazingmarvin.com/*
@muness
muness / BambooHR.gs
Last active February 17, 2021 16:17
BambooHR API client for Google Sheets
// global vars that are taken from userProperties
var BAMBOOHR_SUBDOMAIN = '<fill this out>';
// add a custom menu to enter API credentials, so they don't need to be saved on the script
function onOpen() {
// Add API credentials menu to sheet
SpreadsheetApp.getUi()
.createMenu("BambooHR API Credentials")
.addItem("Set Credentials", "setCred")
.addItem("Remove Credentials", "deleteCred")
CREATE LIBRARY sqlparse LANGUAGE plpythonu FROM 's3://zapier-data-packages/sqlparse.zip' CREDENTIALS 'aws_access_key_id=AKIA6P3ALSQUD7YBV6UK ;aws_secret_access_key=6FzdA0ldVGRuuBqovXpYPZsBLfZN9QAQ8eQbxaK5';
DROP FUNCTION sqlparse_test(ANYELEMENT);
CREATE OR REPLACE FUNCTION sqlparse_test(sql_string ANYELEMENT) RETURNS varchar
IMMUTABLE
language plpythonu
AS
$$
import sqlparse
return (sqlparse.parse(sql_string)[0]).value
@muness
muness / openaudible_split_for_garmin.sh
Created August 15, 2020 15:33
Splits OpenAudible decrypted mp3 files to a form suitable for Garmin watch audiobook playback
#!/bin/bash
# Based on: http://crunchbang.org/forums/viewtopic.php?id=38748#p414992
# m4bronto
# Metadata looks like this:
# Chapter #0:0: start 0.000000, end 1290.013333
# first _ _ start _ end
while [ $# -gt 0 ]; do
@muness
muness / redshift_date_dim.sql
Last active March 14, 2024 17:38
Redshift Date Dimension
-- Potentially quirky when it comes to week numbers.
BEGIN TRANSACTION;
DROP TABLE IF EXISTS numbers_small;
CREATE TABLE numbers_small (
number SMALLINT NOT NULL
) DISTSTYLE ALL SORTKEY (number
);
INSERT INTO numbers_small VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
@muness
muness / sqlite2pg.sh
Last active April 3, 2017 17:23 — forked from eclubb/sqlite2pg.sh
Script to import SQLite3 database into PostgreSQL
#!/bin/sh -ex
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
SQLITE_DB_PATH=$1
PG_DB_NAME=$2
PG_USER_NAME=$3
@muness
muness / find_app
Last active April 20, 2016 20:25
tiny script for use with mas (https://github.com/argon/mas) to find app IDs through the cli with more details than mas search
curl --silent https://itunes.apple.com/search?entity=macSoftware\&term=$1\&attribute=allTrackTerm | jq '.results | .[] | {id: .trackId, name: .trackName, description: .description}'
### Keybase proof
I hereby claim:
* I am muness on github.
* I am muness (https://keybase.io/muness) on keybase.
* I have a public key whose fingerprint is F608 BC76 3CA2 D09D 4EAA 938D F04C 61AE 128A AB1D
To claim this, I am signing this object:
@muness
muness / passpack_to_lastpass.py
Last active August 29, 2015 14:12
Passpack to Lastpass format converter
#!/usr/bin/python
# Based on https://plus.google.com/+TonyScelfo/posts/LvuRq9mToR1
import csv
in_file = open('in.csv', 'rb')
out_file = open('out.csv', 'wb')
reader = csv.reader(in_file, delimiter=',', quotechar='"')
writer = csv.writer(out_file, delimiter=',', quotechar='"')
xml_out.Trips do
for page in (1..pages)
past_trips = t.list.trip({'past' => 'true', 'include_objects' => 'false', 'traveler' => 'true', "page_size" => "30", "page_num" => page})
node = Nokogiri::XML(past_trips.to_xml.to_s)
xml_out << node.xpath("//Trip").to_xml
end
end