Skip to content

Instantly share code, notes, and snippets.

@aifreedom
aifreedom / fix_downkyi_ass.py
Created February 15, 2022 06:36
Fix the invalid timestamp strings in the downloaded danmaku ass files
# Fixes the invalid timestamp string in the downloaded danmaku ass files
# from Downkyi (https://github.com/leiurayer/downkyi). A pull request (https://github.com/leiurayer/downkyi/pull/219)
# has been opened on the repo. This script can be used to fix the downloaded
# ass files before it is merged.
#
# The script has only been tested with limited cases and provided AS-IS.
# The author will NOT be responsible for any data loss for using the script.
#
# Usage: python ./fix_downkyi_ass.py <paths_to_ass_folder>
@aifreedom
aifreedom / nosleep.sh
Created June 24, 2019 00:02
Completely disable sleep on any Mac
# Useful to prevent Macbooks to go to sleep when closing the lid instead of running tools that requires a Kernel Extension (e.g. InsomniaX) and more
sudo pmset -a sleep 0; sudo pmset -a hibernatemode 0; sudo pmset -a disablesleep 1;
# And to go back to normal:
sudo pmset -a sleep 1; sudo pmset -a hibernatemode 25; sudo pmset -a disablesleep 0;
@aifreedom
aifreedom / README.md
Last active August 16, 2018 06:47
TI 8 Fantasy

This script will help you find your best cards and their scores. The work is derived from the data and discussions at http://bbs.ngacn.cc/read.php?tid=14385471

Environment

Tested in Python 3.7

How to use it?

  1. Get Python 3 installed
  2. Save the Python script and player_stats.csv to a local folder
  3. Get your cards.json from the web TI 8 Fantasy portal
  4. Run python find_best_cards.py to help you find your best cards
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
sumOfLastTwo xs = iter xs 0 0
where iter xs s1 s2 = case xs of
[] -> s1 + s2
(y:ys) -> iter ys s2 y
removeSuccessiveDuplicate xs = reverse (iter xs [])
where iter ori rst = case ori of
[] -> rst
(x:xs) -> case rst of
(y:_)
@aifreedom
aifreedom / uninstall-hercules-3.07.bash
Created January 24, 2012 17:35
Uninstall script for Hercules 3.07
#!/bin/bash
rm /usr/local/bin/cckd2ckd
rm /usr/local/bin/cckdcdsk
rm /usr/local/bin/cckdcomp
rm /usr/local/bin/cckddiag
rm /usr/local/bin/cckdswap
rm /usr/local/bin/cfba2fba
rm /usr/local/bin/ckd2cckd
rm /usr/local/bin/cvslvlck