Skip to content

Instantly share code, notes, and snippets.

@bunyk
bunyk / unpacker.py
Last active February 12, 2022 17:01
London Racer: World Challenge unpacker
'''
Unpacker for game archive of London Racer: World Challenge
Expects to run in the folder which contains files WR.idx and WR.img, creates
folder unpacked with the unpacked game resources.
See https://bunyk.github.io/posts/reverse_engineering_game_archive to know how this was made.
'''
import os
import struct
@bunyk
bunyk / tracer.go
Last active June 9, 2020 08:38
ray tracer in a weekend
package main
import (
"fmt"
"image"
"image/jpeg"
"log"
"math"
"math/rand"
"os"
@bunyk
bunyk / song.py
Created August 27, 2019 11:43
Ти ж мене підманула
def пісня():
def куплет(день, заняття):
print(f'''
Ти казала у {день}
{заняття},
Я прийшов, тебе нема,
Підманула-підвела.'''
)
def приспів():
trans_table = {
'A': ('A', 0), 'a': ('a', 0),
'Ą': ('A', 1), 'ą': ('a', 1),
'C': ('C', 0), 'c': ('c', 0),
'Ć': ('C', 1), 'ć': ('c', 1),
'E': ('E', 0), 'e': ('e', 0),
'Ę': ('E', 1), 'ę': ('e', 1),
'L': ('L', 0), 'l': ('l', 0),
'Ł': ('L', 1), 'ł': ('l', 1),
'N': ('N', 0), 'n': ('n', 0),
import pyglet
WINDOW_WIDTH = 800
WINDOW_HEIGHT = 600
window = pyglet.window.Window(
width=WINDOW_WIDTH, height=WINDOW_HEIGHT, caption="Pong!"
)
class Paddle:
"""Widget to check office time without opening page.
https://askubuntu.com/questions/751608/how-can-i-write-a-dynamically-updated-panel-app-indicator
http://candidtim.github.io/appindicator/2014/09/13/ubuntu-appindicator-step-by-step.html
https://python-gtk-3-tutorial.readthedocs.io/en/latest/introduction.html
"""
from datetime import timedelta
import os
from time import sleep
@bunyk
bunyk / keypair.go
Last active June 27, 2018 13:59
RSA Keypair generation
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"fmt"
"log"
)
@bunyk
bunyk / main.go
Created March 18, 2018 15:52
Баланс дужок
package main
import (
"fmt"
"log"
"os"
)
import sys
import json
for line in sys.stdin:
try:
entry = json.loads(line)
print('\033[0;37m', entry['time'], entry['level'], '\033[0m', entry['msg'])
except ValueError:
print('\033[0;31m!', line, '\033[0m')
@bunyk
bunyk / sleepsort1.go
Last active March 2, 2018 12:11
Go concurrency examples
package main
import (
"fmt"
"time"
)
func sleepSort(array []int) []int {
rc := make(chan int)