Skip to content

Instantly share code, notes, and snippets.

Avatar
🐍
Focusing

Sanchit Balchandani inovizz

🐍
Focusing
View GitHub Profile
@shubham1172
shubham1172 / container.py
Last active Mar 4, 2020
HydPy February Container Snippet
View container.py
import os
import sys
import unshare
import random
import string
import cgroups
if len(sys.argv) == 1:
print(f"Usage {sys.argv[0]} cmd args")
sys.exit(1)
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active Sep 23, 2021
Fix DNS resolution in WSL2
View fix-wsl2-dns-resolution
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@vasanthk
vasanthk / System Design.md
Last active Sep 23, 2021
System Design Cheatsheet
View System Design.md

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@kracekumar
kracekumar / hashmap.py
Last active Sep 3, 2021
Hash Map implementation in Python
View hashmap.py
### Hash implementation in python
def custom_hash(key):
"""
Return the hash value of the given key. Uses dbj2
@param key: String or unicode
"""
result = 5381
multiplier = 33
@yosemitebandit
yosemitebandit / openpyxl-install-with-pip
Created Jun 4, 2012
reading xlsx files in python with openpyxl
View openpyxl-install-with-pip
$ pip install -E ~/conf/virtualenvs/xyuml https://bitbucket.org/ericgazoni/openpyxl/get/1.5.8.zip