Skip to content

Instantly share code, notes, and snippets.

@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 March 25, 2025 19:25
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
@csghone
csghone / open_source_video_tools.md
Last active August 10, 2020 13:54
Open Source Video Tools

NOTE: This was originally maintained in TI E2E wiki here. It was written primarily for Windows users. Some data might be out of date - corrections are welcome.

Downloads

  • For Ubuntu:
    • sudo apt-get install mpv ffmpeg mplayer mkvtoolnix-gui mkvtoolnix x264 x265 lame
    • If you need nightly builds check following PPAs:
  • Doug McMahon
@csghone
csghone / aws_vpc_setup.md
Last active September 8, 2020 11:52
AWS VPC Setup

Summary

  • Overall setup consists of
    • EC2 instance with open outbound internet access and only SSH inbound access via OpenVPN server
    • S3 endpoints to optimize S3 usage
    • IPSEC tunnel to local firewall
    • OpenVPN server with a public IP

Create an account