Skip to content

Instantly share code, notes, and snippets.

View pringlized's full-sized avatar

Jim Pringle pringlized

View GitHub Profile
@pringlized
pringlized / how-to-use-pelican.md
Created November 11, 2023 06:51 — forked from JosefJezek/how-to-use-pelican.md
How to use Pelican on GitHub Pages
@pringlized
pringlized / gist:9acf8b6cc04ca0f0fb93aa90d1e69fb1
Last active November 28, 2023 02:00 — forked from mberman84/gist:9e008131d96af27256cc9cb53ad834cf
CodeLLaMA Installation - Windows & WSL2
#
# I have successfully run this with Anaconda on Windows directly & on WSL2/Ubuntu 22.04 with MiniConda
#
# Make sure you have Anaconda installed
# This tutorial assumes you have an Nvidia GPU, but you can find the non-GPU version on the Textgen WebUI github
# More information found here: https://github.com/oobabooga/text-generation-webui
# Make sure you have the CUDA 11.8 & cuDNN 11.x installed
# CUDA Toolkit 11.8: https://developer.nvidia.com/cuda-18-7-0-download-archive
@pringlized
pringlized / bfs.ex
Last active May 18, 2017 06:45
Elixir Breadth First Search
defmodule Ellow.Zones.BFS do
def zone_map(name, parent \\ nil) do
%{
name: name,
distance: 0,
parent: nil
}
end
@pringlized
pringlized / .bashrc
Created May 7, 2017 22:44
Displaying git info in base command prompt
function git_branch() {
git_branch=$(git branch --no-color 2>/dev/null | grep \* | sed 's/* //')
if [ $git_branch ]
then
white="\001\033[0;37m\002"
yellow="\001\033[0;33m\002"
blue="\001\033[0;34m\002"
red="\001\033[0;31m\002"
green="\001\033[0;32m\002"
@pringlized
pringlized / postgre_table_sizes
Created April 8, 2017 22:56
postgre tale sizes
SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
AND C.relkind <> 'i'
AND nspname !~ '^pg_toast'
ORDER BY pg_total_relation_size(C.oid) DESC
LIMIT 20;
@pringlized
pringlized / postgres_alter_sequence
Created April 8, 2017 01:30
Reset PostgreSQL sequence
ALTER SEQUENCE <tableName>_<id>_seq RESTART WITH 1
@pringlized
pringlized / ip.js
Last active November 26, 2016 00:01
Immediately-Invoked Function Expression (IIFE) for generating & validating IPv4 IP addresses
var ip = (function() {
var _privateIps = [
'10.0.0.0',
'10.255.255.255',
'172.16.0.0',
'172.31.255.255',
'192.168.0.0',
'192.168.255.255'
];
@pringlized
pringlized / gist:bf1d3c9071dd2081b403
Created October 14, 2015 17:59
SVN history of a file.
#!/bin/bash
# history_of_file
#
# Outputs the full history of a given file as a sequence of
# logentry/diff pairs. The first revision of the file is emitted as
# full text since there's not previous version to compare it to.
function history_of_file() {
url=$1 # current url of file
on open (theList)
-- I found these extensions for video files here
-- we can check the file extensions of a file against this list to evaluate if it's a video file
set video_ext_list to {"3g2", "3gp", "3gp2", "3gpp", "3mm", "60d", "aep", "ajp", "amv", "asf", "asx", "avb", "avi", "avs", "bik", "bix", "box", "byu", "cvc", "dce", "dif", "dir", "divx", "dv", "dvr-ms", "dxr", "eye", "fcp", "flc", "fli", "flv", "flx", "gl", "grasp", "gvi", "gvp", "ifo", "imovieproject", "ivf", "ivs", "izz", "izzy", "lsf", "lsx", "m1v", "m2v", "m4e", "m4u", "m4v", "mjp", "mkv", "moov", "mov", "movie", "mp4", "mpe", "mpeg", "mpg", "mpv2", "msh", "mswmm", "mvb", "mvc", "nvc", "ogm", "omf", "prproj", "prx", "qt", "qtch", "rm", "rmvb", "rp", "rts", "sbk", "scm", "smil", "smv", "spl", "srt", "ssm", "svi", "swf", "swi", "tivo", "ts", "vdo", "vf", "vfw", "vid", "viewlet", "viv", "vivo", "vob", "vro", "wm", "wmd", "wmv", "wmx", "wvx", "yuv"}
-- notice the use of "entire contents" to also go through subfolders of f
-- use a "whose" f
@pringlized
pringlized / restartCities.sh
Last active August 29, 2015 14:21
Start or Gracefully restart Cities Skylines while coding and compiling a mod
#!/bin/bash
# Check if the CSL app is running
pid=$(ps -ax | grep -m1 'Cities_Skylines/Cities.app' | grep -v grep | awk '{print $1}')
if [[ $pid ]]
then
echo "Cities is running under pid: $pid"
echo "Quitting Cities.."
osascript -e 'quit app "Cities"'
sleep 4