Skip to content

Instantly share code, notes, and snippets.

View trentrand's full-sized avatar
🛰️
⠞⠗⠑⠝⠞

Trent Rand trentrand

🛰️
⠞⠗⠑⠝⠞
View GitHub Profile
@trentrand
trentrand / get-featured-tweets.js
Created August 14, 2024 06:02
Get Featured Tweets
@trentrand
trentrand / telescope.lua
Created September 1, 2023 20:38
Copy relative file path of Telescope.nvim result to clipboard
-- Telescope.nvim command to copy relative path from Telescope#find_files
-- Activating <C-y> on a result will copy the path to clipboard, relative to the path of the current file Buffer
local function relative_path(target_file)
local current_file = vim.fn.expand('%:p') -- Get the full path of the current file
local target_file_full = vim.fn.fnamemodify(vim.fn.resolve(target_file), ':p') -- Get the full path of the target file
local current_parts = vim.split(current_file, '/')
local target_parts = vim.split(target_file_full, '/')
@trentrand
trentrand / contracts...Marketplace.sol
Created August 26, 2021 14:33
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
contract ItemTransaction {
address public owner;
struct Buyer {
uint depositAmount;
bool isReported;
bool exists;
@trentrand
trentrand / TrentsLaptopMods.ckan
Last active March 19, 2021 23:42
My modpack for Comprehensive Kerbal Archive Network (CKAN)
{
"spec_version": "v1.18",
"identifier": "installed-auto",
"name": "installed-auto",
"abstract": "A list of modules installed on the auto KSP instance",
"author": [
"trand"
],
"version": "2021.03.19.11.40.35",
"license": [
@trentrand
trentrand / DroneBuildStatusIndicator.user.js
Last active June 11, 2020 14:28
A TamperMonkey script for displaying the Drone CI (0.X) build status as a fav icon and tab title
// ==UserScript==
// @name DroneBuildStatusTabTitle
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Display Drone CI build status in browser tab title
// @author Trent Rand
// @match https://drone.squarespace.net/*
// @grant none
// ==/UserScript==
@trentrand
trentrand / remove-git-tags-range.sh
Last active June 13, 2019 02:58
Remove a range of git tags from remote by pushing an 'empty' reference to the remote tag name
#!/bin/bash
for i in $(seq $VERSION_MIN $VERISON_MAX); do
git push origin :refs/tags/"0.$i.0";
done
@trentrand
trentrand / Regex for SMS URI (RFC-5724)
Last active July 30, 2024 18:31
Regular expression for validating 'sms' uri scheme. (RFC 5724)[https://tools.ietf.org/html/rfc5724]
This protocol is well-defined by [RFC 5724][1] with the formal definition:
sms-uri = scheme ":" sms-hier-part [ "?" sms-fields ]
scheme = "sms"
sms-hier-part = sms-recipient *( "," sms-recipient )
sms-recipient = telephone-subscriber ; defined in RFC 3966
sms-fields = sms-field *( "&" sms-field )
sms-field = sms-field-name "=" escaped-value
sms-field-name = "body" / sms-field-ext ; "body" MUST only appear once
sms-field-ext = 1*( unreserved )
@trentrand
trentrand / Sanitize media controls - Drag me to your bookmarks bar!
Last active December 10, 2017 01:39
Sanitize third-party media player controls
javascript:(function(){var d=document.createElement('script');d.src='http://code.jquery.com/jquery-latest.js';d.onload=function(){$(".media-control").remove();$("video").prop("controls",true)};document.getElementsByTagName('head')[0].appendChild(d)})()
@trentrand
trentrand / DisableHTCVive.bash
Created October 17, 2017 19:44
Disable HTC VIVE monitor (for hackintosh dual boots)
/Applications/DisableMonitor.app/Contents/MacOS/DisableMonitor --list | egrep '([0-9]*) (?:HTC-VIVE)' | sed 's/[^0-9]//g' | xargs /Applications/DisableMonitor.app/Contents/MacOS/DisableMonitor --disable
@trentrand
trentrand / CountWords.psuedo
Created April 19, 2017 06:49
Psuedo-code for Count Words problem
// Test Cases:
// “A BIG DOG” should return 3
// “A” should return 1
// “ BC “ should return 1
int CountNumWordsInSentence(const char* InString) {
bool wasLetter = true;
int wordCount = 0;
// For this for loop. take advantage that InString is a char pointer.