Skip to content

Instantly share code, notes, and snippets.

@csghone
csghone / netron_build.sh
Created September 26, 2023 08:45
Netron build
git clone https://github.com/lutzroeder/netron.git
cd netron
npm install
npx electron-builder --linux appimage --x64 --publish never
ls $PWD/dist/Netron*AppImage -ltr | awk '{print $NF}' | tail -n 1 | xargs -IXX sudo cp XX /usr/bin/netron
@csghone
csghone / vscode.sh
Last active September 26, 2023 09:15
VSCODE reconnect
vscode_reconnect_insiders ()
{
BIN_DIR=$(ls ~/.vscode-server-insiders/cli/servers/*/server/bin/remote-cli/code-insiders -altr | awk '{print $NF}' | tail -n 1 | sed 's:.code.insiders$::')
export PATH=$PATH:$BIN_DIR
export VSCODE_IPC_HOOK_CLI=$(ls /run/user/${UID}/vscode-ipc-*.sock -ltr | awk '{print $NF}' | tail -n 1)
}
vscode_reconnect ()
{
BIN_DIR=$(ls ~/.vscode-server/cli/servers/*/server/bin/remote-cli/code -altr | awk '{print $NF}' | tail -n 1 | sed 's:.code$::')
@csghone
csghone / vscode_debugger.py
Last active November 21, 2022 15:21
Python "breakpoint()" with VSCode
import os
import sys
import debugpy
# Based on
# https://stackoverflow.com/questions/69690653/remote-debugging-with-debugpy-works-from-code-but-not-from-command-line
# To use with 'breakpoint()'
# export PYTHONBREAKPOINT=vscode_debugger.wait_for_vscode
@csghone
csghone / net_for_wsl.ps1
Created December 6, 2021 06:30
Powershell script to setup DNS for WSL on a Cisco VPN
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
Write-Host > c:\tools\local_ip.txt
# Capture Wi-FI IP address
#Get-NetIPConfiguration | Where-Object {$_.InterfaceDescription -Match "Wi-Fi 6 AX201 160MHz"} | Where-Object {$_.NetAdapter.Status -NotMatch "Disconnected"} | Select-Object IPv4Address >> c:\tools\local_ip.txt
#Get-NetIPConfiguration | Where-Object {$_.InterfaceDescription -Match "I219-LM"} | Where-Object {$_.NetAdapter.Status -NotMatch "Disconnected"} | Select-Object IPv4Address >> c:\tools\local_ip.txt
Get-NetIPConfiguration | Where-Object {$_.NetAdapter.Status -NotMatch "Disconnected"} | Where-Object {$_.InterfaceDescription -NotMatch "Cisco AnyConnect"} | Where-Object {$_.InterfaceDescription -NotMatch "Virtual Ethernet"} |Select-Object IPv4Address >> c:\tools\local_ip.txt
# Get DNS servers
@csghone
csghone / vscode_vim_nvim_wsl.md
Last active September 24, 2025 00:12
VSCode + VIM + NVIM + WSL
@csghone
csghone / tag_s3_objects_for_glacier.py
Created November 23, 2020 09:47
tag_s3_objects_for_glacier
#!/usr/bin/env python3
# PLEASE USE WITH CAUTION - NOT TESTED COMPLETELY
# Actually tagging is intentionally commented out.
from __future__ import print_function
import os
import sys
import argparse
@csghone
csghone / dual_boot_dell.md
Last active December 6, 2020 19:42
Enabling Dual Boot on Dell Laptop

Summary

  • This is a collection of resources used when trying to setup Windows 10 + Ubuntu dual-boot system on Dell Inspiron 7501
  • Windows 10 was pre-installed
  • This was written in Dec 2020 (LUKS vs ecryptfs, LUKS1 vs LUKS2, Intel RST problems)
  • First section list requirements/choices/problems faced in this process
  • Middle sections give details of steps used to solve different problems
  • The last section gives the actual steps used by me.

Considerations

  • Basic requirements
@csghone
csghone / aws_ec2_spot_hibernation.md
Created November 20, 2020 07:58
Using AWS EC2 spot instances with hibernation

Following has been tested on Ubuntu 16.04 - higher versions will require similar steps

Prepare AMI

  • Install hibernation supported kernel and other required utils
sudo apt install -y linux-aws-hwe
sudo apt-get install -y uswsusp
sudo apt-get install -y pm-utils
  • Ensure disk space equivalent to RAM is free. Increase disk if needed
@csghone
csghone / send_to_slack.py
Created August 10, 2020 11:03
Send messages/files to Slack
#!/usr/bin/env python3
"""
eg:
./send_to_slack.py -u csghone '#testingbots' -m hello -e heavy_check_mark
./send_to_slack.py -u csghone '#testingbots' -a send_file -f /path/to/myfile -e heavy_check_mark -m hello
"""
from __future__ import print_function
import os