Skip to content

Instantly share code, notes, and snippets.

@csghone
csghone / dot_viewer.html
Created December 4, 2023 18:31
Dot Viewer
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<title>Dot Viewer</title>
<meta property="og:title" content="Dot Viewer">
</head>
<body>
@csghone
csghone / graphviz_html_label_graph.py
Created December 4, 2023 18:29
Create GraphViz graph with HTML-like labels
#!/usr/bin/env python
import argparse
import logging
import logging.handlers
import os
import sys
import textwrap
import traceback
from dataclasses import dataclass
@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 July 4, 2024 09:19
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