Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
unity and python is all a man needs

Badjano badjano

💭
unity and python is all a man needs
View GitHub Profile
@badjano
badjano / favorites.txt
Last active Feb 20, 2021
My Pico-8 favorites
View favorites.txt
|46281 |42655 |1794 |ultrabrite | |sewers of d'oh!
|nightride-0 |nightride |1794 |vladcom | |night ride
|toyrogue-0 |toyrogue |1794 |extar | |toyrogue 1.0
|metrash-2 |metrash |1794 |st33d | |metrash
|pakpok-0 |pakpok |1794 |st33d | |pakpok
|cgprospector-0 |cgprospector |1794 |st33d | |cgprospector
|celeste_classic_2-5 |celeste_classic_2 |1794 |noel | |celeste classic 2
|dollarone_nightatthemuseum-0 |dollarone_nightatthemuseum |1794 |dollarone | |dollarone_nightatthemuseum
|picpots-0 |picpots |1794 |enrohk | |picpots
|flipknight-0 |flipknight |1794
View pdf2png.py
import fitz # pip install pymupdf
pdffile = "file.pdf"
doc = fitz.open(pdffile)
for i in range(doc.pageCount):
page = doc.loadPage(i)
zoom = 5
pix = page.getPixmap(matrix=fitz.Matrix(zoom, zoom))
output = "file_%d.png" % i
pix.writePNG(output)
@badjano
badjano / img_duplicates.py
Last active Nov 25, 2020
Search for all image duplicates in folders and subfolders, preserving the one with larger size
View img_duplicates.py
import hashlib
from glob import glob
import os
import cv2
import subprocess
def md5_for_file(path):
with open(path, 'rb') as f:
md5 = hashlib.md5()
@badjano
badjano / foscam_cv_stream.py
Created Oct 26, 2020
Foscam Open CV Stream
View foscam_cv_stream.py
from threading import Thread
import cv2
def connect(user, pwd, ip="192.168.0.1", port=88):
cap = cv2.VideoCapture('rtsp://%s:%s@%s:%d/videoMain' % (user, pwd, ip, port))
while True:
ret, frame = cap.read()
View fibo_ma_rainbow.pine
//@version=4
study("Fibonacci MA rainbow", overlay=true)
period = input(title="MA period", type=input.integer, defval=100)
scale = input(title="Period Scale", type=input.integer, defval=1)
power = input(title="Fibonacci Scale", type=input.float, defval=1, step=0.1)
offset = input(title="Fibonacci Offset", type=input.float, defval=0, step=0.1)
smoothing = input(defval="WMA", options=["RMA", "SMA", "EMA", "WMA", "VWMA", "SMMA", "DEMA", "TEMA", "HullMA", "LSMA"])
almaOffset = input(defval=0.85, minval=0, type=input.float, step=0.05)
almaSigma = input(defval=6, minval=0, type=input.float, step=0.5)
View rsa_encryption.py
import os
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
def save_file(path, bytes):
answ = "y"
if os.path.exists(path):
answ = input("File %s exists, replace? (y/n) " % path)
if "y" in answ.lower():
View blender28_make_instances.py
import bpy
srcs = ['grao_trigo_01_geo','Retopo_coentro1_low','Retopo_coentro2_low','Retopo_coentro3_low']
selected_objects = bpy.context.selected_objects
bpy.ops.object.select_all(action='SELECT')
all_objects = bpy.context.selected_objects
bpy.ops.object.select_all(action='DESELECT')
src_objects = [bpy.data.objects[src] for src in srcs]
View blender28_remove_empty.py
import bpy
scene = bpy.context.scene
obs = set()
for ob in scene.objects:
for mod in ob.modifiers:
if mod.type == 'MIRROR':
obs.add(mod.mirror_object)
@badjano
badjano / stock_to_flow_btc.py
Last active Feb 20, 2020
Stock to flow model
View stock_to_flow_btc.py
#please donate BTC: 1BADjanox8xaNUYTQgHcXw6mmwuSsE9ZSg
import datetime
import locale
import matplotlib.pyplot as plt
locale.setlocale(locale.LC_ALL, 'en_CA.UTF-8')
reward = 50
total_btc = 0
View btc_bottom_top.pine
// © Badjano 2019
// please donate BTC: 1BADjanox8xaNUYTQgHcXw6mmwuSsE9ZSg
//@version=4
study("BTC Bottom and Top", overlay=true)
float t = (time*0.001-1100000000) * 0.000000001
t1 = plot(pow(t * 5 ,10.0), color=color.green)
t2 = plot(pow(t * 5.65 ,9.0), color=color.green)
t3 = plot(pow(t * 7.75 ,8), color=color.red)
t4 = plot(pow(t * 9 ,7.5), color=color.red)
fill(t1, t2, color=color.green, transp=90)