Skip to content

Instantly share code, notes, and snippets.

View Bigjaked's full-sized avatar

Jake Bigjaked

  • iMuto Software Solutions
  • USA
View GitHub Profile
@Bigjaked
Bigjaked / datamatrix.js
Created November 25, 2024 22:24
Modified version of datamatrix-svg to force a 20x20 grid.
/**
https://github.com/datalog/datamatrix-svg
under MIT license
# datamatrix.js has no dependencies
Copyright (c) 2020 Constantine
*/
function DATAMatrix(Q) {
var M = [],
xx = 0,
yy = 0,
@Bigjaked
Bigjaked / alchemy_base_dao.py
Created July 19, 2024 22:42
Sqlalchemy async base dao to be used with pydantic models and mypy using the data access object pattern
# License MIT
# Author Jake Duncan.
# [email protected]
# copyright 2023
from typing import Any, Generic, Type, TypeVar
from engine import Session, engine
from models import Base
@Bigjaked
Bigjaked / useQueryParam.ts
Created July 16, 2024 23:16
React useQueryParam implementation with default and setter
import { useLocation, useSearchParams } from "react-router-dom"
import { useCallback, useEffect, useState } from "react"
/**
* This hook will watch and return the value of a query param. If the defaultValue is provided,
* it will be set if the query param is not found.
* @param key The query param to get
* @param defaultValue A value to set if the query param is not found
*/
export const useQueryParam = <T extends string = string>(key: string, defaultValue?: string): [T, (s: T) => void] => {
@Bigjaked
Bigjaked / vimconfig.sh
Created April 14, 2021 17:02
Vim config with some plugins
# endwise - auto closes ruby ends
mkdir -p ~/.vim/bundle
git clone git://github.com/tpope/vim-endwise.git ~/.vim/bundle
# ctrlp - Fuzzy search via ctrl + p
mkdir -p ~/.vim/bundle
git clone https://github.com/kien/ctrlp.vim.git bundle/ctrlp.vim ~/.vim/bundle
# nerdtree - tree display for current directory in vim
mkdir -p ~/.vim/bundle
git clone https://github.com/preservim/nerdtree.git ~/.vim/bundle
# supertab - all your auto completion for insert mode
@Bigjaked
Bigjaked / vim_settings.vim
Last active April 14, 2021 17:02
These are some vim settings for ruby
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" source ~/.vimrc.before if it exists.
if filereadable(expand("~/.vimrc.before"))
source ~/.vimrc.before
endif
" ================ General Config ====================
set number relativenumber "Line numbers are good
set backspace=indent,eol,start "Allow backspace in insert mode
@Bigjaked
Bigjaked / python_function_memoizer.py
Created October 12, 2020 16:53
Python memoized function decorator with a singleton resetable cache.
class Memoized(object):
"""Decorator. Caches a function's return value each time it is called.
If called later with the same arguments, the cached value is returned instead
of running the function again.
Note: This memoizer only works with functions that don't have keyword arguments.
This particular implementation of the class uses a single cache instance for
all cached functions. It uses the singleton pattern to accomplish this. The advantages
of this implementation is that we have control of the caches for each function in
the main *Memoized* class. This allows us to clear or reset the caches for all
@Bigjaked
Bigjaked / sanic-run.py
Created June 14, 2018 16:27 — forked from wonderbeyond/sanic-run.py
A sanic entry-script for development (supports auo-reload, shell-mode)
import argparse
from app import app
def main():
parser = argparse.ArgumentParser(
description='Sanic test server',
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
@Bigjaked
Bigjaked / install_factorio_server.sh
Created August 13, 2017 23:22
script to install a factorio server on ubuntu (upstart only)
#!/bin/sh
# Created by bigjaked392 on 2016-09-28
# based partially on gist found here https://gist.github.com/cbednarski/3ada27b2c401cc163dc4
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
@Bigjaked
Bigjaked / gist:170dca237488fc2cdf1d4e2aea31e43b
Created November 17, 2016 04:53 — forked from aaronshaf/bookmarklet-expanded.js
Copy text from Amazon's Cloud Reader
// Useful for students in need of block quotes for their paper, etc.
// Execute the line in your JavaScript console
new_window=window.open();new_window.document.body.innerHTML = $('iframe').contents().find('iframe').contents().find('body').get(1).innerHTML;
javascript:new_window=window.open();new_window.document.body.innerHTML = $('iframe').contents().find('iframe').contents().find('body').get(1).innerHTML;
@Bigjaked
Bigjaked / openvpn_gen.py
Created September 22, 2016 05:11 — forked from Justasic/openvpn_gen.py
This is a python script to generate client OpenVPN configuration files. This is based mostly on the easyrsa script and is much simpler to understand.
import os
import socket
from OpenSSL import crypto, SSL
# OpenVPN is fairly simple since it works on OpenSSL. The OpenVPN server contains
# a root certificate authority that can sign sub-certificates. The certificates
# have very little or no information on who they belong to besides a filename
# and any required information. Everything else is omitted or blank.
# The client certificate and private key are inserted into the .ovpn file
# which contains some settins as well and the entire thing is then ready for