Skip to content

Instantly share code, notes, and snippets.

View jstott's full-sized avatar

Jim Stott jstott

View GitHub Profile
@jstott
jstott / wsl2-network.ps1
Created January 25, 2023 21:22 — forked from xmeng1/wsl2-network.ps1
WSL2 Port forwarding port to linux
$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;
}
@jstott
jstott / setupmachine.bat
Created June 7, 2022 13:04 — forked from shanselman/setupmachine.bat
WinGet Setup a New Machine
winget install --id=Microsoft.VisualStudioCode -e && winget install --id=AgileBits.1Password -e && winget install --id=7zip.7zip -e && winget install --id=Twilio.Authy -e && winget install --id=Bethesda.Launcher -e && winget install --id=Microsoft.Bicep -e && winget install --id=Microsoft.bitsmanager -e && winget install --id=BrutalChess.BrutalChess -e && winget install --id=TechSmith.Camtasia -e && winget install --id=code52.Carnac -e && winget install --id=Docker.DockerDesktop -e && winget install --id=joncampbell123.DOSBox-X -e && winget install --id=JGraph.Draw -e && winget install --id=Dropbox.Dropbox -e && winget install --id=ElectronicArts.EADesktop -e && winget install --id=File-New-Project.EarTrumpet -e && winget install --id=Elgato.ControlCenter -e && winget install --id=Elgato.StreamDeck -e && winget install --id=EpicGames.EpicGamesLauncher -e && winget install --id=Figma.Figma -e && winget install --id=TimKosse.FileZilla.Client -e && winget install --id=BlastApps.FluentSearch -e && winget install
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
@jstott
jstott / userGeoLocation.js
Created August 13, 2020 02:24
Detect User's Current Location Using HTML5 Geolocation
// Since this can compromise privacy, the position is not available unless the user approves it.
function get_location() {
try {
navigator.geolocation.watchPosition((pos) => {
try {
var coords = pos.coords;
} catch {
var coords = false;
}
if (!coords) {

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@jstott
jstott / git.migrate
Created February 17, 2019 19:17 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@jstott
jstott / linux-dev-box.md
Created March 26, 2018 23:11
Linux Dev Machine Utils / Setup
@jstott
jstott / indexFragmentation.sql
Created February 10, 2017 18:41
MS SQL check the index fragmentation
DECLARE @DatabaseID int
SET @DatabaseID = DB_ID()
SELECT DB_NAME(@DatabaseID) AS DatabaseName,
schemas.[name] AS SchemaName,
objects.[name] AS ObjectName,
indexes.[name] AS IndexName,
objects.type_desc AS ObjectType,
indexes.type_desc AS IndexType,
@jstott
jstott / paginated.js
Created January 14, 2017 16:22
lodash paginated items
function getPaginatedItems(items, page, pageSize) {
var pg = page || 1,
pgSize = pageSize || 100,
offset = (pg - 1) * pgSize,
pagedItems = _.drop(items, offset).slice(0, pgSize);
return {
page: pg,
pageSize: pgSize,
total: items.length,
total_pages: Math.ceil(items.length / pgSize),