Skip to content

Instantly share code, notes, and snippets.

View Dillie-O's full-sized avatar

Sean Patterson Dillie-O

View GitHub Profile
@Dillie-O
Dillie-O / wsl_remove_win_path_zsh.sh
Created January 5, 2018 16:29
[WSL Remove Win Path in ZSH] Remove windows specific path from WSL environment in ZSHRC #wsl #environment #configuration
# Remove Windows paths to Ruby since it causes conflicts with npm/bower/etc.
PATH=$(echo :$PATH: | sed -e 's,:/mnt/c/tools/ruby22/bin:,:,g' -e 's/^://' -e 's/:$//')
@Dillie-O
Dillie-O / get_all_media.ps1
Created October 20, 2016 22:57
PowerShell script to iterate all containers and blobs in a storage account and download it.
$destination_path = 'C:\Users\dilli\Downloads\media_dump'
$connection_string = '[AZURE_STORAGE_CONNECTION_STRING]'
$storage_account = New-AzureStorageContext -ConnectionString $connection_string
$containers = Get-AzureStorageContainer -Context $storage_account
Write-Host 'Starting Storage Dump...'
foreach ($container in $containers)
@Dillie-O
Dillie-O / run_app_as_user.bat
Created November 5, 2021 16:07
[Run Apps As User] Launch an application as a different user (helpful with VPN users) #command #runas #batch
@ECHO off
cls
:start
ECHO.
ECHO 1. Visual Studio 2019
ECHO 2. VS Code
ECHO 3. Sql Server Management Studio
ECHO.
set choice=
@Dillie-O
Dillie-O / vsc-remove-dupes
Last active March 9, 2021 19:49
[VSC Remove Duplicate Lines] Remove duplicate lines from text in Visual Studio Code
Open Search/Replace (CTRL+H), change settings to Regular Expressions (click .*)
Enter Find: ^(.+\n)(?=(?:.*\n)*?\1)
Leave Replace blank
Press CTRL+ALT+Enter
Profit!
@Dillie-O
Dillie-O / x11_forward_su.sh
Created January 22, 2020 22:11
[X11 forward for su] Update X11 forwarding for super user #shell #unix #x11
# After logging in as a normal user, change to the su account, but don't use
# the '-' to preserve display values. Finally, append your users xauth settings
# onto your own, which will include the "cookie" for X11 forwarding
sudo su
xauth add $(xauth -f ~[user]/.Xauthority list|tail -1)
@Dillie-O
Dillie-O / git_scrub_large_file.sh
Created December 17, 2019 23:33
[Remove Large File from Git History] Scrubs full git history to remove reference to file specified #git
git filter-branch --index-filter 'git rm --cached --ignore-unmatch [file_name]' HEAD
@Dillie-O
Dillie-O / hyper-config.txt
Created November 13, 2019 18:07
Hyper Config (for debugging)
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@Dillie-O
Dillie-O / gist:2480125
Created April 24, 2012 14:32
Amazon S3 Download File with Prompt
public static void DownloadObject(string keyName)
{
string[] keySplit = keyName.Split('/');
string fileName = keySplit[keySplit.Length - 1];
string dest = Path.Combine(HttpRuntime.CodegenDir, fileName);
using (client = Amazon.AWSClientFactory.CreateAmazonS3Client())
{
GetObjectRequest request = new GetObjectRequest().WithBucketName(bucketName).WithKey(keyName);
@Dillie-O
Dillie-O / clone_git_repo_no_history_powershell.ps
Last active September 19, 2019 21:10
[Clone Git Repo Without History] Clone Git repo without history #powershell #git
$location = "[path_to_new_folder]"; git archive master --format zip -o "$location.zip"; expand-archive "$location.zip" -DestinationPath $location; ri "$location.zip"
# Expand-Archive will auto-create destination folder.
# Can use path such as $HOME/Projects/my_project to shortcut.
@Dillie-O
Dillie-O / clone_git_repo_no_history_bash.sh
Created September 18, 2019 20:20
[Clone Git Repo Without History] Clone Git repo without history #bash #git
mkdir -p [path_to_new_directory] && git archive master | tar -x -C [path_to_new_directory]