This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINAka9pEckb9hukyCQ+MCohwowz6pie/Itlb4QSf2+yv noname |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
OPENSSL_VER=3.0.0 | |
mkdir openssl | |
cd openssl | |
wget https://www.openssl.org/source/openssl-${OPENSSL_VER}.tar.gz | |
tar xf openssl-${OPENSSL_VER}.tar.gz | |
cd openssl-${OPENSSL_VER} | |
./config zlib shared no-ssl3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ "$1" = "" ] && echo "wifi version | wifi join [ssid] [password] | wifi get"; | |
[ "$1" = "version" ] && echo "wifi v1.0 by Ian"; | |
[ "$1" = "join" ] && networksetup -setairportnetwork en0 $2 $3; | |
[ "$1" = "get" ] && networksetup -getairportnetwork en0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -x | |
clear | |
for file in $(find ./ -type f -name "*.py") | |
do | |
mypy --exclude '/setup\.py$' --exclude '.*build.*' ${file} | |
echo "===================================================" | |
isort ${file} | |
echo "===================================================" | |
black --line-length 79 ${file} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Leetcode 200 | |
# https://leetcode.com/problems/number-of-islands/ | |
def dfs(grid, i, j): | |
if grid[i][j] == "1": | |
grid[i][j] = "0" | |
if i-1 >= 0: | |
dfs(grid, i-1, j) | |
if i+1 < len(grid): | |
dfs(grid, i+1, j) | |
if j-1 >= 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Leetcode 102 103 | |
# Breadth First Search Simplest | |
def bfs(root): | |
queue = [root] | |
while queue: | |
n = queue.pop(0) | |
queue.append(n.left) | |
queue.append(n.right) | |
# based on that, what we are deadling with might not be a perfect binary tree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from textblob import TextBlob | |
tb = TextBlob("I am very happy") | |
print(tb.sentiment) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
# number of all points in 1/4 circle / number of all points = pi/4 | |
def pi(n): return sum( [random.random()**2 + random.random()**2 <= 1 for _ in range(n)] ) / n * 4 | |
# % python3 -i pi.py | |
print(pi(100)) | |
# 3.52 | |
print(pi(1000)) | |
# 3.104 | |
print(pi(10000)) | |
# 3.1448 |