Skip to content

Instantly share code, notes, and snippets.

View Sam-Gram's full-sized avatar

Sam Graham Sam-Gram

  • Fusionware, Inc.
  • Idaho Falls, ID
View GitHub Profile
#!/bin/bash
# Show last 10 tags by creation date
git for-each-ref --sort=-creatordate refs/tags --format='%(refname:lstrip=2)' --count=10
import ora from 'ora'
const spinner = ora({
text:'Emoji',
spinner: {
frames: Array(76).fill(0).map((_,i) => String.fromCodePoint(128516+i)),
interval: 100
}
}).start()
@Sam-Gram
Sam-Gram / vscode_sql_cleanup.regex
Created November 3, 2022 19:37
Used for cleaning up useless column aliases, where it's like name as name in vscode.
Search: \.?(?<column>[\w_]+) as \k<column>
replace: .$1
changeBackground ()
{
gsettings set org.gnome.desktop.background picture-uri file://`ls /home/sam/Documents/Wallpapers/*.jpg | shuf -n 1`
}
int GetWeekNumberOfMonth(DateTime date)
{
date = date.Date;
DateTime firstMonthDay = new DateTime(date.Year, date.Month, 1);
return (date - firstMonthDay).Days / 7 + 1;
}
@Sam-Gram
Sam-Gram / cloudSettings
Last active August 30, 2019 20:08
vscodesync
{"lastUpload":"2019-08-30T20:08:34.891Z","extensionVersion":"v3.4.2"}
@Sam-Gram
Sam-Gram / sliceofthemonth.sh
Created June 4, 2019 16:25
Get Lucy's slice of the month
slice-of-the-month ()
{
curl -s -L https://www.lucysnypizza.com/specials | grep --color=auto h2 | perl -pe 's/<[^>]*>//g' | perl -ne 'print if /slice.*month/i' | perl -pe 's/.*: (.+)$/$1/'
}
SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('column_name') AND TABLE_SCHEMA = 'table_name';
@Sam-Gram
Sam-Gram / bash_exclamation_explanation.org
Last active March 28, 2019 20:57
Bash exclamation point expansions
ShortcutExplanation
!!Last command
!:nLast command’s nth argument
!*Last command’s arguments
!$Last command’s last argument
!:m-nLast command’s mth through nth arguments
!:n-Last command’s nth through second-to-last arguments
!:n-$Last command’s nth through last arguments
!:n*Last command’s nth through last arguments
@Sam-Gram
Sam-Gram / gist:2b2657d06c2b9c48012b80fe30a09d82
Last active February 7, 2019 23:30
enable_gnome_stuff.sh
# Add below line to .bashrc then source .bashrc
gnome-shell-extension-cl -l | egrep "pomodoro|TopIcons|caffeine|openweather|EasyScreen|deskchange|pomodoro" | awk '{print $1}' | xargs -L1 gnome-shell-extension-cl -e
# if gnome-shell-extension-cl is missing do:
# sudo wget https://raw.githubusercontent.com/cyberalex4life/gnome-shell-extension-cl/master/gnome-shell-extension-cl -O /usr/local/bin/gnome-shell-extension-cl && sudo chmod +x /usr/local/bin/gnome-shell-extension-cl