Skip to content

Instantly share code, notes, and snippets.

View strix's full-sized avatar

Brance Boren strix

View GitHub Profile
@strix
strix / currency-calculations.html
Last active December 19, 2024 20:23
Currency Calculations
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Currency Calculations</title>
<script src="https://unpkg.com/[email protected]/dist/web/js-big-decimal.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="preconnect" href="https://fonts.bunny.net">
@strix
strix / rofi-gpaste.sh
Last active November 25, 2020 00:05 — forked from tadly/rofi-gpaste.sh
rofi + gpaste
#!/usr/bin/env bash
#
# Use rofi to select an entry from gpaste
#
# Requirements:
# rofi, gpaste
#
line=`gpaste-client --oneline | \
rofi -theme Monokai -dmenu -i -p clipboard -kb-custom-1 Ctrl+x $@`
@strix
strix / git-fuzzy-searchers.sh
Created September 16, 2020 20:59
Better git log and git stash fuzzy searching
# Based off examples from https://gist.github.com/junegunn/f4fca918e937e6bf5bad
# git log show with fzf
gli () {
# param validation
if [[ ! `git log -n 1 $@ | head -n 1` ]] ;then
return
fi
@strix
strix / bash-shortcuts.md
Created November 29, 2018 21:00
Useful Bash Shortcuts

NOTE: this is a markdown, slightly edited version of this article

The bash shell has a very rich array of convenient shortcuts. This ability to edit the command line using shortcuts is provided by the GNU Readline library. This library is used by many other *nix application besides bash, so learning some of these shortcuts will not only allow you to zip around bash commands with absurd ease, but can also make you more proficient in using a variety of other *nix applications that use Readline. By default Readline uses emacs key bindings, although it can be configured to use the vi editing mode. If you’re familiar with emacs then many of these shortcuts will not be new to you.

Command Editing Shortcuts

  • Ctrl + a – go to the start of the command line
  • Ctrl + e – go to the end of the command line
  • Ctrl + k – delete from cursor to the end of the command line
  • `Ctrl
@strix
strix / recursive-file-crawl.js
Created November 21, 2018 07:37
Recursive file crawling with async await
const findFiles = async (startPath) => {
const results = []
const findRecursive = async (recursiveStartPath) => {
const files = await readdir(recursiveStartPath)
for (const file of files) {
const currentFile = `${recursiveStartPath}/${file}`
const stats = await stat(currentFile)
if (stats.isFile()) {
results.push(path.resolve(currentFile))
} else if (stats.isDirectory()) {
@strix
strix / renameapp.py
Last active November 17, 2016 21:51
Django management command to change app names
from django.core.management.base import BaseCommand, CommandError
from django.db import connection
from django.apps import apps
class Command(BaseCommand):
help = ('Renames an app in the database. You will need to change imports and migrations manually')
def add_arguments(self, parser):
# Positional arguments
@strix
strix / idea-online-helper.js
Last active November 24, 2015 19:42
For all IDEA course feedback surveys. Copy and paste this script in the console and it will mark all radio buttons with the value 5. You can then go through and change the questions you feel deserve less.
function markAllTheThings(){
$(document).ready(function(){
var frameContext = function(){
return window.parent.frames[1].document;
};
// You can change the value of qsox to any number between 1-5 for your default checked value
$(':radio[qsox="5"]', frameContext()).prop('checked', true);
});
}
@strix
strix / consolelog.js
Last active July 5, 2023 13:32
Console log for XSS testing
(function(){
console.log('The form on this site is vulnerable <3 strix');
alert('The form on this site is vulnerable <3 strix');
}());
@strix
strix / canvas_qa.js
Last active August 29, 2015 14:13
Canvas Query Completed Quiz
// $('.text .question_text').text() // returns all the question text
// $('.display_question') // returns all q&a blocks
// $('.display_question.incorrect') // returns all incorrect q&a block
// $.get('url-to-js-file', function(data){eval(data)}); // to get and run the code
// localStorage.setItem('test', JSON.stringify({ 'one': 1, 'two': 2, 'three': 3 })) // saves stringified js object in localStorage
// JSON.parse(localStorage.getItem('test')) // gets and parses that object from localStorage
var printIt = function(arr){
for(var i=0; i<arr.length; i++){