This file contains 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
# WS client example | |
import asyncio | |
import websockets | |
import time | |
async def receive(): | |
uri = "ws://localhost:9999" | |
async with websockets.connect(uri) as websocket: |
This file contains 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
# * Keyboad autocomplete * | |
set show-all-if-ambiguous on | |
if [ -f `brew --prefix`/etc/bash_completion.d/git-completion.bash ]; then | |
. `brew --prefix`/etc/bash_completion.d/git-completion.bash | |
fi | |
# * Customizing PS1 - Add Battery Percentage * | |
# get_battery() { | |
# acpi | egrep -o '([0-9]+)%' | |
# } |
This file contains 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
# Investment simulation on FIIs over years | |
import math | |
import matplotlib.pyplot as plt | |
import locale | |
locale.setlocale(locale.LC_ALL, '') | |
# FII | |
price = 10 | |
dividends = 0.08 |
This file contains 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 | |
# xdotool | |
#xdotool click --repeat 10000 --delay 10000 1 | |
# cliclick | |
while true | |
do | |
cliclick c:0,0 | |
sleep 10 |
This file contains 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 | |
networksetup -setairportpower en0 off | |
sudo -S date 1015000021 # set available date MMddHHmmYY | |
read -p "Press any key to continue... " -n1 -s | |
networksetup -setairportpower en0 on | |
echo "" |
This file contains 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
# Terraform v1.2.0 | |
# | |
# Terraform Simple Project with AWS - Apache Server | |
# | |
# $ terraform init | |
# $ terraform plan | |
# $ terraform apply --auto-approve | |
# $ terraform output | |
# $ terraform refresh | |
# $ terraform destroy -target aws_route_table_association.a --auto-approve |
This file contains 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 | |
# Script used to create django project integrated with javascript/react frontend | |
# Execute these command to run: | |
# $ sh mkproj.sh | |
# $ python manage.py runserver | |
# $ yarn run dev | |
# set project name and frontend package name | |
PROJ_NAME='app' |
This file contains 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 cv2 | |
import numpy as np | |
from collections import Counter | |
import matplotlib.pyplot as plt | |
def check_countour(shape, contour): | |
# Get array X: | |
arr = list(dict(sorted(Counter(contour[:, 0, 0]).items())).values()) # sort by key and get values (histogram) | |
arr = arr[int(len(arr)*0.1):len(arr)-int(len(arr)*0.1)] # crop 10% of the begin and end of array | |
# Rect conditions: |
This file contains 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
''' | |
config.yml | |
path: /path/to/folder | |
text1: | |
old: "xxxxx" | |
new: "yyyyy" | |
''' | |
''' |
This file contains 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 cv2 as cv | |
import numpy as np | |
class SignatureBackgroundRemoval: | |
def process_signature(self, img): | |
img = cv.GaussianBlur(img,(5,5),0) | |
img = cv.cvtColor(img, cv.COLOR_BGR2GRAY) | |
ret, img = cv.threshold(img,0,255,cv.THRESH_BINARY+cv.THRESH_OTSU) | |
alpha = np.ones(img.shape, dtype=img.dtype)*255 | |
out = cv.merge((img, img, img, alpha)) |
OlderNewer