Skip to content

Instantly share code, notes, and snippets.

View damp11113's full-sized avatar
🤗
Hi dev

dharm pimsen damp11113

🤗
Hi dev
View GitHub Profile
@damp11113
damp11113 / camogen.py
Last active April 3, 2024 16:57
camouflage generator using cellular automata algorithm
import random
import numpy as np
from PIL import Image, ImageDraw
from damp11113.processbar import indeterminateStatus
class camogen:
def __init__(self, grid_size=128, num_frames=15, color=[(75, 83, 32), (225, 215, 152), (103, 86, 69), (66, 71, 86)], ranseedx=0, ranseedy=100):
self.grid_size = (grid_size, grid_size)
self.num_frames = num_frames
self.colors = color
import board
import digitalio
import time
import simpleio
def string_to_binary_list(input_string):
binary_list = []
for char in input_string:
# Convert each character to its ASCII value and then to binary
binary_char = bin(ord(char))[2:]
@damp11113
damp11113 / pygame_template.py
Created March 2, 2024 10:32
pygame project template
import sys
import pygame
class Game:
def __init__(self):
# System Variable
self.screen = None
self.clock = None
self.running = False
@damp11113
damp11113 / dearpygui_template.py
Last active March 2, 2024 10:32
dearpygui project template
import dearpygui.dearpygui as dpg
class App:
def __init__(self):
pass
def window(self):
with dpg.window(label="Test"):
dpg.add_text("Hello world")
@damp11113
damp11113 / opus_encoder.py
Created November 11, 2023 07:13
PyOgg opus encoder add set_bitrates and set_bandwidth
import ctypes
from typing import Optional, Union, ByteString
from . import opus
from .pyogg_error import PyOggError
class OpusEncoder:
"""Encodes PCM data into Opus frames."""
def __init__(self) -> None:
self._encoder: Optional[ctypes.pointer] = None
#include <stdio.h>
int main() {
float epsilon = 1;
float one = 1;
while (1 + epsilon != 1) {
printf("Epsilon = %.12f\n", epsilon);
epsilon/=2;
}
@damp11113
damp11113 / EASAMETH.py
Last active October 5, 2023 15:49
The first Prototype EAS (emergency alert system) in Thailand using SAME encode (Specific Area Message Encoding) With Python. For use with Radio or audio streaming.
# same encoder for thailand by damp11113
import datetime
import numpy as np
import pyaudio
import time
import soundfile as sf
from scipy import signal
import os
import pyttsx3
@damp11113
damp11113 / pyserssh.py
Last active March 17, 2024 15:50
V1.5 simple python ssh server with paramiko. Full version is here https://github.com/damp11113/PyserSSH
import os
import subprocess
import paramiko
import socket
import sys
import threading
from damp11113 import pyversion, osversion, cmd, list2str
import pyfiglet
@damp11113
damp11113 / m4formatprototype.py
Last active June 15, 2023 15:17
multiplex4 (m4) is a compressed file hence has a small capacity. And can store multi IQ data simultaneously (sample 4bit)
import struct
def create_multiplex4_file(filename, sample_rate, data_format, data_streams):
with open(filename, 'wb') as file:
# Write header information
header = struct.pack('!If', sample_rate, data_format)
file.write(header)
# Write data streams
for stream_data in data_streams:
@damp11113
damp11113 / MCSE.py
Last active April 20, 2023 09:31
Minecraft Sounds Extractor python
import os
import json
import shutil
# ---------------- setting here --------------------
extracted_path = <extracted folder>
objects_path = <objects folder>
index_json = <index file ex 1.19.json>
# ---------------------------------------------------