Skip to content

Instantly share code, notes, and snippets.

View unrelentingfox's full-sized avatar
🤓
Learning

Dustin unrelentingfox

🤓
Learning
View GitHub Profile
@unrelentingfox
unrelentingfox / skhdrc
Last active May 8, 2024 21:41
This https://github.com/koekeishiya/skhd configuration rings an alarm bell every time you use the wrong shift key. I am experiencing pain in my left pinky, probably because I rely completely on the left shift key for everything. I created this configuration as a way to teach myself to use the right shift key.
# Keyboard event codes 0x00 found at: https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values
# Block using left shift for left half of the keyboard
lshift - 0x32 : osascript -e "beep" # `
lshift - 1 : osascript -e "beep"
lshift - 2 : osascript -e "beep"
lshift - 3 : osascript -e "beep"
lshift - 4 : osascript -e "beep"
lshift - 5 : osascript -e "beep"
lshift - 6 : osascript -e "beep"
@unrelentingfox
unrelentingfox / useful-bash.sh
Last active August 30, 2023 21:21
A list of one liner bash commands that I found useful and would like to remember
# Find all files installed with a package e.g. tilda
dpkg -L tilda
# Get the size of a file
du -sh file_path
# Get the summary of disk usage of currect directory, human readable, with total, sorted by size
du -shc * | sort -h
# Show more context in grep
@unrelentingfox
unrelentingfox / kraken-avg-cost.py
Last active June 18, 2022 19:25
A python script that queries all of your historic trades and calculates the average price you purchased coins at. This was a quick script based on the examples found here: https://docs.kraken.com/rest/. I am open to feedback!!
#!/usr/local/bin/python3
import base64
import hashlib
import hmac
import json
import os
import requests
import time
import urllib.parse
@unrelentingfox
unrelentingfox / facebook-ad-insights.gs
Created June 23, 2021 06:37
An example of how you can use the facebook api to populate a google sheet.
// https://www.benlcollins.com/apps-script/api-tutorial-for-beginners/
function main() {
let accessToken = "YOUR_ACCESS_TOKEN"
let fields = "account_id,account_name,date_start,date_stop,impressions,spend"
let accountIds = getAccountIds(accessToken)
let jsonData = getAdInsights(accountIds, fields, accessToken)
let sheet = SpreadsheetApp.getActiveSheet()
let dataKeys = Object.keys(jsonData[0])
let dataArray = convertToArray(dataKeys, jsonData)
dataArray.unshift(dataKeys)
@unrelentingfox
unrelentingfox / locker.sh
Last active April 22, 2021 01:05
Quick 7z based directory locking script. I created this because I want an easy way to quickly encrypt and decrypt a directory.
#!/bin/bash
USAGE_TEXT="Usage: locker.sh <command> target
Commands:
lock Expects target to be a directory. This directory will be compressed
with a password using 7z removing the original directory afterwards.
unlock Expects target to be a 7z compressed file. Unlocks the given
@unrelentingfox
unrelentingfox / nvim-update-to-tag.sh
Last active April 19, 2021 20:57
A script to use for dynamically installing a tag version of Neovim.
#!/bin/bash
if [ -z "$1" ]
then
TAG="stable"
else
TAG=$1
fi
TMP_FILE=nvim-macos.tar.gz
alias pcat='pygmentize -g'
alias chrome='google-chrome-stable'
alias gfr='git svn fetch; git svn rebase'
alias work='cd ~/workspace/'
alias home='cd ~'
alias bprops='vim /etc/cwan/titan/basic.properties'
alias bpropsd2='vim /etc/cwan/titan/d2/basic.properties'
alias rm='rm -v'
alias mv='mv -v'
alias cp='cp -v'
<code_scheme name="Titan (hand entered)" version="173">
<option name="SOFT_MARGINS" value="120" />
<JavaCodeStyleSettings>
<option name="SPACE_AROUND_TYPE_BOUNDS_IN_TYPE_PARAMETERS" value="false" />
<option name="BLANK_LINES_AROUND_INITIALIZER" value="0" />
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
</JavaCodeStyleSettings>
<SqlCodeStyleSettings version="2">
<option name="ALIAS_CASE" value="1" />
# For use when you need trace level logs
status = error
name = PropertiesConfig
filters = threshold
filter.threshold.type = ThresholdFilter
filter.threshold.level = trace
appenders = console
# delete till end of line
dt$