Skip to content

Instantly share code, notes, and snippets.

View ereli's full-sized avatar

Ereli ereli

View GitHub Profile
@ereli
ereli / exit_tax.py
Created August 9, 2023 21:33
Try to calculate if you need to pay exit tax
import argparse
from datetime import datetime, timedelta
import yfinance as yf
def get_stock_price(ticker, date):
target_date = datetime.fromisoformat(date).replace(tzinfo=None)
start_date = (target_date - timedelta(days=7)).strftime("%Y-%m-%d")
end_date = (target_date + timedelta(days=7)).strftime("%Y-%m-%d")
@ereli
ereli / vpc.fish
Created April 15, 2021 02:33
Enumerate all VPCs you have on all AWS regions
for region in af-south-1 ap-east-1 ap-northeast-1 ap-northeast-2 ap-northeast-3 ap-south-1 ap-southeast-1 ap-southeast-2 ca-central-1 cn-north-1 cn-northwest-1 eu-central-1 eu-north-1 eu-south-1 eu-west-1 eu-west-2 eu-west-3 me-south-1 sa-east-1 us-east-1 us-east-2 us-gov-east-1 us-gov-west-1 us-west-1 us-west-2
echo $region
aws ec2 describe-vpcs --region $region |jq '.Vpcs[]|[.VpcId, .CidrBlock, (.Tags[]|select(.Key=="Name")).Value]|@csv' -rc 2>/dev/null
end
@ereli
ereli / disk_space.sh
Created April 28, 2020 20:51
show disk space over 1G
sudo du -h|grep -P '^\d+\.?\d?G'
@ereli
ereli / hello.go
Last active November 3, 2024 12:26
How to sign macOS and Windows executables using self-signed certificates on a Mac.
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
@ereli
ereli / Procfile
Last active February 15, 2022 11:51
Contractor day-rate calculator
web: streamlit run --server.enableCORS false --server.port $PORT calculator.py
@ereli
ereli / hostname.go
Last active March 19, 2019 04:51
set hostname on linux. Useful if the machine doesn't have hostnamectl and you don't want to reboot.
package main
import (
"flag"
"fmt"
"os"
"syscall"
)
func main() {
@ereli
ereli / gist:82d8107b10c5d73c3ecdeeabc195b6d6
Created August 30, 2018 19:55
scan and crop image using scanimage and convert
scanimage --mode=Color --resolution=300 > foo.pnm;convert foo.pnm -crop (convert foo.pnm -virtual-pixel edge -blur 0x15 -fuzz 15% -trim -format '%[fx:w]x%[fx:h]+%[fx:page.x]+%[fx:page.y]' info:) +repage 5.jpeg
@ereli
ereli / gist:6f5874c8c46509299721f5c3f462f930
Created July 2, 2018 20:54
tar every folder in the current directory
for file in (find . -maxdepth 1 -type d)
tar -v --remove-files -cSf (basename $file).tar (basename $file)/
end
@ereli
ereli / gist:3cbec2bd84de4a808f6aa00a489ac7e8
Created July 2, 2018 17:38
remove spaces from directories - fish shell
for file in (find . -maxdepth 1 -type d)
mv -- (basename $file) (string replace -a ' ' _ $file)
end
@ereli
ereli / capturestill_multicamera.py
Last active February 15, 2023 05:36
capture still images from multiple cameras using python pygame
import time
from pathlib import Path
import pygame
import pygame.camera
from pygame.locals import *
from datetime import datetime
pygame.init()
pygame.camera.init()