Skip to content

Instantly share code, notes, and snippets.

View superkeyor's full-sized avatar

Keyor superkeyor

View GitHub Profile
@superkeyor
superkeyor / firefox_extension.sh
Last active January 1, 2024 18:10
bash script to export an addon/extension's url uuid given its (partial) name
function firefox_extension() {
# Usage: firefox_extension "name" ["url|uuid"]
# Parameters:
# extension_name (string): The name of the addon (case insensitive, could be partial, via grep).
# parameter_type (string): The type of information to retrieve (url, uuid).
# Examples:
# firefox_extension "Bitwarden - Free Password Manager" "uuid"
# firefox_extension (Lists all available extension names)
# Notes:
# extensions.json has name, url, id
@superkeyor
superkeyor / cfgsync.sh
Last active January 6, 2024 00:58
bash script to maintan configuration files in macOS (inspired by mackup)
cfgsync() {
# Usage: cfgsync {uplink|linkstore|backup|restore|reset} {directory_or_file} [-q|--quiet]
# cfgsync backup Clipboard # initialize backup, assuming config/ subfolder in backup
# cfgsync restore Clipboard/config/clipboard.cfg # restore to a new machine
#
# uplink: (backup first + link second) Backs up the original file/folder, according to .cfg, by copying it to a backup location and then creates a symbolic link to the backup in the original place.
# linkstore: (link to an existing backup to restore) Restores the original file by removing it (if it exists) and creating a symbolic link to the backup in the original place.
# backup: (backup, no link) Backs up the original file/folder, according to .cfg, by copying it to a backup location. No symbolic link is created.
# restore: (restore, no link) Similar to linkstore, but instead of creating a symbolic link, it copies the backup back to the origina
@superkeyor
superkeyor / installapp.sh
Last active December 24, 2023 04:16
Bash script to install app on macOS from command line (can handle various situations)
function installapp {
local path=$1
local quiet=$2
if [ -z "$path" ]; then
echo "Usage:"
echo " installapp <path/to/directory> - Search a directory for dmg, pkg, zip files (in that order) to install."
echo " installapp <path/to/file> - Install a specific dmg, pkg, or zip file."
echo " installapp <URL> - Download and install a (dmg, pkg, zip) file from a URL."
@superkeyor
superkeyor / README.MD
Created March 9, 2023 21:14 — forked from RichardBronosky/README.MD
cb - A leak-proof tee to the clipboard - Unify the copy and paste commands into one intelligent chainable command.

cb

A leak-proof tee to the clipboard

This script is modeled after tee (see [man tee][2]) and works on Linux, macOS, Cygwin, WSL/WSL2

It's like your normal copy and paste commands, but unified and able to sense when you want it to be chainable.

This project started as an answer to the StackOverflow question: [How can I copy the output of a command directly into my clipboard?][3]

@superkeyor
superkeyor / medium-to-scribe.js
Created December 20, 2022 23:33 — forked from samhenrigold/medium-to-scribe.js
UserScript to redirect medium.com articles to scribe.rip
// ==UserScript==
// @name Medium to Scribe
// @description Redirects Medium.com articles to scribe.rip
// @match *://*/*
// @exclude /^https?://(www\.)?medium\.com/((\?.*)|((m|about|creators|membership)/.*))$/
// @run-at document-end
// @version 1.2.4
// @updateURL https://gist.githubusercontent.com/samhenrigold/4a082dde823bc3cb62e43a2fc2b12b8e/raw/medium-to-scribe.js
// ==/UserScript==
@superkeyor
superkeyor / ffmpeg-commands.sh
Created September 6, 2022 03:55 — forked from 44213/ffmpeg-commands.sh
ffmpeg commands.
# To extract the sound from a video and save it as MP3:
ffmpeg -i <video.mp4> -vn <sound>.mp3
# To convert frames from a video or GIF into individual numbered images:
ffmpeg -i <video.mpg|video.gif> <frame_%d.png>
# To combine numbered images (frame_1.jpg, frame_2.jpg, etc) into a video or GIF:
ffmpeg -i <frame_%d.jpg> -f image2 <video.mpg|video.gif>
# To quickly extract a single frame from a video at time mm:ss and save it as a 128x128 resolution image:
@superkeyor
superkeyor / sqlite3-in-python.py
Created February 15, 2021 21:30 — forked from 7aman/sqlite3-in-python.py
sqlite3 cheatsheet for python 3
#!/usr/bin/env python3
'''
Thanks to Andres Torres
Source: https://www.pythoncentral.io/introduction-to-sqlite-in-python/
'''
import sqlite3
# Create a database in RAM
@superkeyor
superkeyor / write.Hmisc.SPSS.R
Created January 26, 2016 21:23 — forked from mrdwab/write.Hmisc.SPSS.R
Write an SPSS file from R with variable labels from the Hmisc package
write.Hmisc.SPSS = function(data, datafile, codefile) {
# EXAMPLE DATA (see: http://stackoverflow.com/q/10181730/1270695)
# df <- data.frame(id = c(1:6),
# p.code = c(1, 5, 4, NA, 0, 5),
# p.label = c('Optometrists', 'Nurses',
# 'Financial analysts', '<NA>',
# '0', 'Nurses'),
# foo = LETTERS[1:6])
# Add some variable labels using label from the Hmisc package
# require(Hmisc)
@superkeyor
superkeyor / DragHereToValidate.bat
Created September 27, 2015 03:16 — forked from radum/DragHereToValidate.bat
SublimeText 2 IBM SPSS Dimensions (build system, syntax higlight, snippets, etc)
:: If you want to use a batch file try this. Make a shortcut and drag n drop the file to be validated on it
Call "mrScriptCL.exe" "{path_to_mrs_validator}\ProjectValidator.mrs" /a:mddpath=%1
PAUSE
@superkeyor
superkeyor / covcheck_free.m
Created September 22, 2015 21:55 — forked from vsoch/covcheck_free.m
Coverage Checking for SPM Analysis
function covcheck_free()
% COVERAGE CHECKING for SPM ANALYSIS (covcheck_free.m)
% Vanessa Sochat
%
% This script takes in a list of subjects processed in SPM, an ROI mask
% that will be used for group analysis, and a user specified coverage
% percentage. It will calculate the size of a single subject mask and
% determine if the subject has that percentage coverage.
%__________________________________________________________________________
%