Skip to content

Instantly share code, notes, and snippets.

View oO0oO0oO0o0o00's full-sized avatar
😝
Meow~

oO0oO0oO0o0o00 oO0oO0oO0o0o00

😝
Meow~
View GitHub Profile
@oO0oO0oO0o0o00
oO0oO0oO0o0o00 / MinecraftPiano.ahk
Last active April 28, 2024 15:41
Play piano in Music Maker Mod of Minecraft with custom key bindings. Semi-automatical recording supported as well.
; Win + A to loop among: recording mode, active, and inactive.
; recording: write clicks to recording.txt
#Requires AutoHotkey v2.0
mode := "inactive"
kiss := [
["a", 1732, 494],
["s", 1793, 500],
["d", 1856, 492],
@oO0oO0oO0o0o00
oO0oO0oO0o0o00 / Hammerspoon-init.lua
Created December 15, 2023 09:56
Kittenal script of Hammerspoon on MacOS for IME fixes and screen sleeping optimization. Uploaded as backup. Not general purpose.
require "hs.caffeinate"
require "hs.hotkey"
-- Exchange windows on these 2 out of 3 monitors if they are moved to the other.
internal_screen_id = "37D8832A-2D66-02CA-B9F7-8F30A301B230"
right_screen_id = "BFF6E135-AF30-4853-A5EF-EE64D279FA06"
apps_grouping = {
[internal_screen_id] = {right_screen_id, {
"飞书"
@oO0oO0oO0o0o00
oO0oO0oO0o0o00 / l4d2_custom_maps.json
Created January 3, 2022 12:17
BSP filename to mod name lookup table for common Left 4 Dead 2 custom maps. Ctrl + F & search for filename shown by `openserverbrowser`. Do not include ".bsp" extension. 根据 bsp 地图文件名反查 L4D2 mod 名字
{
"Death Woods": [
"l4d2_deathwoods01_stranded",
"l4d2_deathwoods02_tunnel",
"l4d2_deathwoods03_bridge",
"l4d2_deathwoods04_power",
"l4d2_deathwoods05_airfield"
],
"Death Row": [
"deathrow01_streets",
@oO0oO0oO0o0o00
oO0oO0oO0o0o00 / decode_waystone_position.py
Created October 6, 2021 13:54
Decode the position of Waystone (of Waystone mod)
import argparse
def sign_extend(value: int, bits: int) -> int:
""" Perform sign extension operation.
"""
sign_bit = 1 << (bits - 1)
mask = sign_bit - 1
return (value & mask) - (value & sign_bit)
@oO0oO0oO0o0o00
oO0oO0oO0o0o00 / gradient_reversal_tf_keras.py
Last active July 23, 2021 03:00
Gradient Reversal Layer for tf.keras of TensorFlow 2
import tensorflow as tf
from tensorflow import keras
class GradientReversal(keras.layers.Layer):
"""Flip the sign of gradient during training.
based on https://github.com/michetonu/gradient_reversal_keras_tf
ported to tf 2.x
"""
def __init__(self, λ=1, **kwargs):
@oO0oO0oO0o0o00
oO0oO0oO0o0o00 / config_tap.bat
Last active July 23, 2021 02:14
Configure the intranet VPN (TAP/TUN) to only route intranet traffic
@echo off
REM Automaticaly configure your network so that the VPN (TAP) of your intranet
REM provider (employer/campus) won't unintentionally block your access to the
REM Internet while working from home.
REM Change corresponding names and IP ranges to fit your need.
REM Designed for typical home PC behind routers, without PPPoE.
REM The code is provided as-is without warranty.
powershell -command Start-Process powershell -Verb runAs -ArgumentList ^
@oO0oO0oO0o0o00
oO0oO0oO0o0o00 / start_juice.bat
Created September 5, 2020 03:18
Run 100% Orange Juice on secondary display (incl. virtual display + stream to Steam Link during working time)
@if (@CodeSection == @Batch) @then
@echo off
REM run 100% Orange Juice on secondary screen
REM pay attention to "*** TODO: ***"s in the script
REM Download & install cmdow.exe (https://ritchielawrence.github.io/cmdow) & add to PATH
echo Starting Juice from Sbeam...
import java.util.Arrays;
public class HelloWorld {
public static void main(String[] args) {
byte abyte = (byte) 3;
if (Math.random() < 1) abyte++;// No static opt
Object a = abyte;
Object b = (Object) (byte) 4;
Object c = (Object) 4;