Skip to content

Instantly share code, notes, and snippets.

View jgentes's full-sized avatar
🎯
Crushing it

James Gentes jgentes

🎯
Crushing it
View GitHub Profile
@jgentes
jgentes / $profile
Last active March 29, 2024 00:28
powershell autocomplete
Import-Module posh-git
Set-PSReadlineKeyHandler -Key Tab -Function Complete
Set-PSReadLineKeyHandler -Chord "Tab" -Function AcceptSuggestion
Set-PSReadLineKeyHandler -Chord "RightArrow" -Function ForwardWord
@jgentes
jgentes / multisync
Created June 21, 2023 03:26
archive multisync logic
play: async (trackId?: Track['id']) => {
let tracks
if (!trackId) {
// pull players from audioState to play all
;[tracks] = getAudioState()
tracks = Object.keys(tracks) as Track['id'][]
} else tracks = [trackId]
for (const trackId of tracks) {
if (trackId) setAudioState[trackId as number].playing(true)
// Type User can have an ID which is either a number or a string
type User<CustomType extends number | string> = {
id: CustomType
name?: string
age?: number
}
// In this case, we define CustomType as a string
let myUser: User<string> = {
id: '1234-1234-1234',

// Type User can have an ID which is either a number or a string type User<CustomType extends (number | string)> = { id: CustomType, name?: string, age?: number }

// In this case, we define CustomType as a string let myUser:User = { id: "1234-1234-1234",

@jgentes
jgentes / type definition from array.ts
Created October 31, 2022 13:45
Quickly define the values needed in an array and use that array as a type definition
const arrayOfStringLiterals = ['a', 'b', 'c'] as const
type TypeArrayOfStringLiterals = typeof arrayOfStringLiterals[number]
@jgentes
jgentes / gist:c59f24f2dd54dcb29c13dc1ac12c1f7f
Created July 22, 2020 22:22
Powershell script to fix Windows 10 WSL2 port forwarding problem
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
@jgentes
jgentes / .bashrc
Created July 10, 2020 17:52
Automatically start MSQL in WSL2
export MYSQLPID=$(pidof mysqld)
if [ -z $MYSQLPID ]; then sudo service mysql start; fi
@jgentes
jgentes / gist:1b1cd850be43d10b8106579aef2ce78b
Created December 12, 2018 15:57
my bash color console
export PS1='\[\033[0;36m\] \w\[\033[0;32m\] - [$(git branch 2>/dev/null | grep "^*" | colrm 1 2)\[\033[0;32m\]]\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\]\[\033[0m\] '
@jgentes
jgentes / docker-compose.yml
Created April 5, 2018 17:00
Failing docker-compose for resin
---
version: '2'
services:
sidekick:
restart: always
privileged: true
build:
args:
GIT_KEY: abcd
image: ./sidekick
@jgentes
jgentes / AngelList Markets.csv
Created September 30, 2015 01:43 — forked from eAndrius/AngelList Markets.csv
All AngelList Market tags with market url, id, number of followers, investors, startups and jobs, in no particular order. Scraped from https://angel.co/markets on 04/04/2015
name url id followers investors startups jobs
Information Technology https://angel.co/information-technology 25 6860 2381 84617 12929
Consumers https://angel.co/consumers 24 3969 1268 58531 7753
Enterprises https://angel.co/enterprises 733 3465 1172 36913 6727
Media https://angel.co/media-1 11 4699 1549 10186 1097
Health Care https://angel.co/health-care 13 113123 22508 7750 1154
Education https://angel.co/education 43 11233 3727 7495 993
Finance https://angel.co/finance 321 5029 1681 7143 1362
Life Sciences https://angel.co/life-sciences 9 3871 1285 4467 274
Platforms https://angel.co/platforms 152 3742 1218 4119 669