Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View badjano's full-sized avatar
💭
unity + python + c++

Badjano badjano

💭
unity + python + c++
View GitHub Profile
// © 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)
import math
from moviepy.editor import concatenate, ImageClip
import os
import platform
import subprocess
import random
import torch
# pip install pytorch-pretrained-biggan
from pytorch_pretrained_biggan import (BigGAN, truncated_noise_sample, convert_to_images)
import numpy as np
import pygame
import time
import random
wants_to_quit = False
pause = False
delay = 1.0
plus_pressed = False
minus_pressed = False
screen_size = (640, 360)
@badjano
badjano / music_gen.py
Last active February 27, 2019 19:10
Music Generator
from math import floor
import random
from midiutil.MidiFile import MIDIFile
MyMIDI = MIDIFile(1)
track = 0
time = 0
tempo = 130
@badjano
badjano / kmeans_palette.py
Last active December 14, 2018 22:32
Finding palette from image using K-Means Clustering
import random
from PIL import ImageDraw, Image
from statistics import median
max_dist = pow(255, 2) + pow(255, 2) + pow(255, 2)
global_power = (2, 2, 2)
def avg(arr):
return sum(arr) / len(arr)
@badjano
badjano / sprite_sheet.py
Created November 23, 2018 00:53
Sprite Sheet Patcher
from math import floor
from PIL import Image
def make_sprite_sheet(folder):
files = ["%s/bkfire%04d.png" % (folder, a) for a in range(1, 65)]
images = [Image.open(a) for a in files]
width, height = images[0].size
@badjano
badjano / pixel_sort.py
Created November 14, 2018 22:32
Pixel Sorting
import random
from PIL import ImageFilter, Image
import os
def randomize(data, width, height, chunk_count):
new_data = []
for i in range(height):
chunk = int(width / chunk_count)
for j in range(chunk_count):
@badjano
badjano / threading.cs
Created October 30, 2018 03:49
Unity threading example
using System;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
public class TerrainChunk : MonoBehaviour
{
private MeshFilter _meshFilter;
private MeshCollider _meshColllider;
@badjano
badjano / imgconvimg.py
Last active October 19, 2018 23:06
ImageConvolutionImage
from PIL import ImageFilter, Image
from math import floor, sqrt, tanh
from threading import Thread, Lock
from multiprocessing import cpu_count
from queue import Queue
import time
import pygame
lock = Lock()
q = Queue()
@badjano
badjano / Cloud.shader
Created August 8, 2018 00:06
Unity cloud shader
Shader "ShaderMan/Clouds"
{
Properties{
_Color("Sky Color", Color) = (0.6, 0.7, 0.8, 1)
_CamPosition("Camera Position", Vector) = (0,0,0,0)
_CamRotation("Camera Rotation", Vector) = (0,0,0,0)
_Rotation("Camera Rotation", float) = 0
_Iterations("Cloud Iterations", Range(100,750)) = 170