Skip to content

Instantly share code, notes, and snippets.

Avatar
🍑
uwu?

thinkier

🍑
uwu?
  • Melbourne, Australia
View GitHub Profile
@thinkier
thinkier / tax.ts
Created Jun 10, 2022
Australian Marginal Income Tax calculator (dumps to csv)
View tax.ts
const brackets: Array<[number, number]> = [
[ 0, 0],
[ 18200, 19],
[ 45000, 32.5],
[ 120000, 37],
[ 180000, 45]
];
console.log("Income", "Tax");
@thinkier
thinkier / github_webhook.php
Created Apr 4, 2022
Automanted code deployment based on github webhooks (on pull request merge into the main branch)
View github_webhook.php
<?php
const REPO_DIR = "/env";
const DISCORD_WEBHOOK = "...";
const TOKEN = "...";
if (key_exists('auth', $_GET) && $_GET['auth'] == TOKEN) {
$payload = json_decode($_POST['payload'], true);
if (key_exists("action", $payload) &&
$payload["action"] == "closed" &&
@thinkier
thinkier / pickletime.rs
Created May 7, 2020
Convert unix time to skyblock time
View pickletime.rs
const TIME_OFFSET: f64 = 1559829300.0;
pub fn unix_to_date(mut unix: f64) -> String {
let time = (unix - TIME_OFFSET) as u64;
let year = time / 12 / 31 / 1200;
let month = (time / 31 / 1200) % 12;
let day = ((time / 1200) % 31) + 1;
format!("Year {}, {} {}{}", year, month_str(month), day, day_suffix(day))
@thinkier
thinkier / update-usernames.sh
Last active Apr 26, 2020
Updates usernames on your old git repositories.
View update-usernames.sh
#!/bin/sh
###
### License: Public Domain, or the equivalent in your jurisdiction
### USE AT YOUR OWN RISK, I WILL NOT TAKE ANY RESPONSIBILITY IF YOU USED THIS AND FUCKED UP YOUR REPOSITORY.
###
### # Description
### Updates usernames on your old repositories.
###
# I know it's a bad hack but I'm too lazy to even do the replace command in an editor
@thinkier
thinkier / rh4.rs
Created Nov 30, 2019
Calculate how different armors tank Revenant Horror 4 in Hypixel Skyblock
View rh4.rs
fn main() {
let base_hp = 479.;
let base_def = 58.;
print!("Revenant Armor (50k)");
let mut rev = RevArmor::new(base_hp, base_def, 280. * 3., 5., 5., 0.);
tank(&mut rev);
print!("Revenant Armor (25k)");
let mut rev = RevArmor::new(base_hp, base_def, 260. * 3., 5., 5., 0.);
View htoprc
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 17 111 2 46 47 49 1
sort_key=0
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=0
show_thread_names=1
@thinkier
thinkier / dsa-notification.php
Last active Apr 26, 2020
PHP Script to fetch the RSS feed to debian security and send a webhook to discord when it has a new one. (This generates dsaCache where it's ran.) Prerequisite: PHP>= 5.6, php5-cron, php5-cli, read and write access to local directory.
View dsa-notification.php
<?php
/**
* Usage: php dsa-notification.php
* In cron (hourly): 0 * * * * cd /absolute/path/of/your/directory && php dsa-notification.php
*/
$hooks = ["https://discordapp.com/api/webhooks/{webhook.id}/{webhook.token}"];
if (php_sapi_name() == "cli") {
$knownDSA = json_decode(file_get_contents("dsaCache"), true);
$rssFeed = simplexml_load_string(file_get_contents("https://www.debian.org/security/dsa"));