Skip to content

Instantly share code, notes, and snippets.

View ereli's full-sized avatar

Ereli ereli

View GitHub Profile
@ereli
ereli / hello.go
Last active April 20, 2024 08:48
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 / gist:e868fcaeb660e420d7a6
Last active April 3, 2024 10:01
Installing Centos using DHCP, TFTP and Kickstart

Installing Centos using DHCP, TFTP and Kickstart Files.

We want to deploy physical nodes before cluster installation, in order to speed up the deployment, we'd like to automate most of the process, requiring us only to enter hostnames and IP address. we will need:

  • A DHCP Server
  • TFTP Server
  • HTTP Server
  • Centos ISO file
  • Optionally: local repo server, local dns server, local ntp server.
@ereli
ereli / countries.sql
Last active March 28, 2024 06:40 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes. PostgreSQL compatible
CREATE SEQUENCE country_seq;
CREATE TABLE IF NOT EXISTS country (
id int NOT NULL DEFAULT NEXTVAL ('country_seq'),
iso char(2) NOT NULL,
name varchar(80) NOT NULL,
nicename varchar(80) NOT NULL,
iso3 char(3) DEFAULT NULL,
numcode smallint DEFAULT NULL,
phonecode int NOT NULL,
@ereli
ereli / gist:a0faf53e417403df8863
Created April 9, 2015 10:15
prevent screensaver and workstation lockout - vbs script that presses the numlock key twice every 10 seconds
# ref: http://superuser.com/a/836346
Dim objResult
Set objShell = WScript.CreateObject("WScript.Shell")
i = 0
Do While i = 0
objResult = objShell.sendkeys("{NUMLOCK}{NUMLOCK}")
Wscript.Sleep (10000)
@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 / 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()
@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 / 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 / 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() {