Skip to content

Instantly share code, notes, and snippets.

View curioustorvald's full-sized avatar

CuriousTorvald curioustorvald

View GitHub Profile
@curioustorvald
curioustorvald / Slick2dTransparencyTricks.md
Created March 1, 2017 13:22
Tricks to properly drawing semi-transparent images in Slick2d
  1. Use TGA with Alpha instead of PNG. Grab yourself Paint.NET or GIMP and export the image as 32-bit TGA (no compression). Note that Photoshop can't do the job.
  2. Try this code as blend mode, this code must precede your drawing jobs:
import org.lwjgl.opengl.*

...

GL11.glEnable(GL11.GL_BLEND);
GL11.glColorMask(true, true, true, true);
GL14.glBlendFuncSeparate(
@curioustorvald
curioustorvald / ByteArray64.kt
Last active April 11, 2017 19:28
ByteArray that can hold larger than 4 GiB of data
/**
* ByteArray that can hold larger than 4 GiB of Data.
*
* Works kind of like Bank Switching of old game console's cartridges which does same thing.
*
* Created by Minjaesong on 2017-04-12.
*/
class ByteArray64(val size: Long) {
private val bankSize: Int = 1 shr 30 // 2^30 Bytes, or 1 GiB
@curioustorvald
curioustorvald / bfvm.kts
Last active April 30, 2017 11:19
BrainFuck VM: Needlessly complex brainfuck interpreter
import java.io.InputStream
import java.io.OutputStream
/**
* Just to make things slow down
*
* This version of Brainfuck fills memory with sanitised input program, and initialises
* memory pointer to be just right after your input program. This brings three major improvements:
*
* 1. Possibility of Self-modifying code
@curioustorvald
curioustorvald / colourofglass.md
Last active August 8, 2017 01:59
Colour of household glass pane

While we were replacing old, failing windows and their frames to make it water-tight, I've got a chance to measure a colour of a stack of household glass (they were standing vertically ofc).

As we all know, household glass windows has green tint because of iron impurities.

These are raw readings gathered from Spyder5.

Result is XYZ: 236.516406 370.948442 333.504903, Yxy: 370.948442 0.251354 0.394219
Result is XYZ: 238.322408 373.685700 335.954159, Yxy: 373.685700 0.251405 0.394199
Result is XYZ: 287.492275 451.004721 417.299381, Yxy: 451.004721 0.248740 0.390211
@curioustorvald
curioustorvald / THX.java
Last active June 8, 2018 15:41 — forked from Jobarion/THX.java
THX Deep Note Generator
Git-ified to minjaesong/TEE-H-AXE-Deep-Note-Generator
https://github.com/minjaesong/TEE-H-AXE-Deep-Note-Generator
@curioustorvald
curioustorvald / PasswordBase32.kt
Created February 4, 2019 17:05
Byte-to-Password encoder using Base32 using your plaintext and passphrase
import kotlin.experimental.xor
/**
* Old-school passworld system using Base32
*
* Created by minjaesong on 2017-05-02.
*/
object PasswordBase32 {
@curioustorvald
curioustorvald / UnsafePtr.kt
Last active January 2, 2024 20:17
Java/Kotlin unsafe pointer for unsafe array
package net.torvald
import sun.misc.Unsafe
/**
* Created by minjaesong on 2019-06-21.
*/
object UnsafeHelper {
internal val unsafe: Unsafe
@curioustorvald
curioustorvald / korean_ime_on_ubuntu_based.md
Last active June 14, 2020 03:41
리눅스에서 한글 입력 설정 (두벌식, 세벌식, 드보락, 콜맥)

데비안/우분투 혹은 두벌식+쿼티 사용자를 위한 설정

  1. 리눅스를 영어로 설치, 레이아웃은 일단은 무조건 Qwerty
  2. sudo add-apt-repository ppa:createsc/3beol && apt-get update
  3. sudo apt install libhangul1 (확장 libhangul 모듈)
  4. sudo apt install fcitx-hangul (입력기 설치)
  5. 로그아웃 혹은 재부팅
  6. 설치 후 메뉴에서 fcitx를 실행
  7. 메뉴에서 fcitx configuration을 실행
  8. 설정 창에서 + 버튼으로 "hangul" 이라는 레이아웃 추가 (only show current language 체크 해제)
#!/usr/bin/env python3
# This code is based on tutorial by slicktechies modified as needed to use oauth token from Twitch.
# You can read more details at: https://www.junian.net/2017/01/how-to-record-twitch-streams.html
# original code is from https://slicktechies.com/how-to-watchrecord-twitch-streams-using-livestreamer/
# 24/7/365 NAS adaptation by CuriousTorvald (https://gist.github.com/curioustorvald/f7d1eefe1310efb8d41bee2f48a8e681)
# Twitch Helix API integration by Krepe.Z (https://gist.github.com/krepe90/22a0a6159b024ccf8f67ee034f94c1cc)
# Copyright (c) 2017, 2019, 2020, 2022 Junian, CuriousTorvald and Krepe.Z
#
@curioustorvald
curioustorvald / my-little-streamer-bot.md
Last active February 27, 2024 15:00
How to record twitch live streaming PROPERLY

송출이 불안정한 스트리머의 방송을 최소한의 딜레이로 녹화하도록 만들어진 녹화 스크립트입니다. 호스팅 채널을 녹화하지 않고, TS파일을 직접 저장합니다.

이 스크립트는 24/7 상시감시 및 녹화를 위해 준비된 스크립트이고 설정 과정에서 약간의 프로그래밍적 지식이 필요합니다. 단타성 녹화를 원한다면 더 단순한 거 찾아다 쓰십쇼.

치지직용 스크립트를 테스트하고 있습니다. 여러분의 많은 기여가 필요합니다 🙏🙏

세팅하기 전에

윈도에서도 작동은 하겠지만, 진짜 봇을 구축하려면 이 글의 작성자는 리눅스를 사용하는 걸 추천합니다. 리눅스를 쓰는 이유는, 적어도 얘는 업데이트 있다고 지멋대로 재부팅하지는 않으니까요 (대충 트위치 카파 콘)