Skip to content

Instantly share code, notes, and snippets.

@saryeHaddadi
saryeHaddadi / chmod-400.cmd
Created January 3, 2023 07:28 — forked from jaskiratr/chmod-400.cmd
Set permission of file equivalent to chmod 400 on Windows.
# Source: https://stackoverflow.com/a/43317244
$path = ".\aws-ec2-key.pem"
# Reset to remove explict permissions
icacls.exe $path /reset
# Give current user explicit read-permission
icacls.exe $path /GRANT:R "$($env:USERNAME):(R)"
# Disable inheritance and remove inherited permissions
icacls.exe $path /inheritance:r
import pyodbc
import pandas as pd
df = pd.read_csv('myfile.csv')
MY_TABLE = 'some_tbl'
conn = pyodbc.connect(driver='{ODBC Driver 17 for SQL Server}',
server='MYSERVER',
database='MYDB',
uid='MYUSER', pwd='MYPASSWORD')
@saryeHaddadi
saryeHaddadi / cidr.sh
Created January 3, 2023 07:27 — forked from chadmcrowell/cidr.sh
CIDR chart
CIDR Total Number Network Description:
Notation: of addresses: Mask:
--------------------------------------------------------------------
/0 4,294,967,296 0.0.0.0 All Addresses
/1 2,147,483,684 128.0.0.0 128 /8 networks
/2 1,073,741,824 192.0.0.0 64 /8 networks
/3 536,870,912 224.0.0.0 32 /8 networks
/4 268,435,456 240.0.0.0 16 /8 networks
/5 134,217,728 248.0.0.0 8 /8 networks
/6 67,108,864 252.0.0.0 4 /8 networks