Skip to content

Instantly share code, notes, and snippets.

View miraclx's full-sized avatar
🦀
Pirate of the Crab-ibean

Miraculous Owonubi miraclx

🦀
Pirate of the Crab-ibean
View GitHub Profile
@miraclx
miraclx / u90.rs
Created September 12, 2020 01:20
Rust: 90-bit int
use std::{cmp::min, convert::TryFrom, fmt};
// ((2 ^ 26) - 1)
const MAX_26_BIT_VALUE: u32 = 0x3ffffff;
// ((2 ^ 64) - 1)
const MAX_64_BIT_VALUE: u64 = 0xffffffffffffffff;
// ((2 ^ 90) - 1)
const MAX_90_BIT_VALUE: u128 = ((MAX_26_BIT_VALUE as u128) << 64) | (MAX_64_BIT_VALUE as u128);
#[derive(Default, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug)]
@miraclx
miraclx / dtrak.sh
Created October 12, 2020 00:53
Print actively playing track information
#!/usr/bin/env zsh
function get_active_players() {
for m in `qdbus | egrep -i 'org.mpris.MediaPlayer2|plasma-browser-integration'`
if [[ `qdbus $m /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlaybackStatus` == 'Playing' ]]; then
echo $m
fi
}
function get_player_metadata() {
@miraclx
miraclx / discharge.txt
Last active January 18, 2021 07:45
Instructions for disabling hibernate/hybrid sleep when battery critical on Linux
First, not hibernate
You actually want to disable hybrid sleep
You may not already know it, but trust me
That's what you want
Okay? Good
@miraclx
miraclx / fix_whatsapp.txt
Created November 11, 2020 21:48
Correct ctime on WhatsApp media artifacts
Correct timestamps on WhatsApp media artifacts
# How it works
WhatsApp saves its media files in the format `{TYPE}-{YYYY}{MM}{DD}-WA{NNNN}.{EXT}`
## Examples
- Image: `IMG-20190806-WA0026.jpg`
- Sticker: `STK-20191126-WA0010.webp`
- Audio: `AUD-20181227-WA0045.opus`
- Animated Gifs: `VID-20190103-WA0003.mp4`

Keybase proof

I hereby claim:

  • I am miraclx on github.
  • I am miraclx (https://keybase.io/miraclx) on keybase.
  • I have a public key ASDqJGBAchG6iEbgiaOBRjmyKeUf_nx8Jo_sWtbqXr6K_go

To claim this, I am signing this object:

@miraclx
miraclx / README.md
Last active January 22, 2021 03:15
Git hook for automating push to keybase git repos using a shared bare repo

How to

Don't forget to replace angle brackets <...> with actual values

  • Create a bare git repo (this would be the local shared remote)
git init --bare <repo-name>
cd <repo-name>
@miraclx
miraclx / GitHubRepoSize.user.js
Last active November 17, 2023 16:44
Calculate repo size and inject into GitHub page
// ==UserScript==
// @name GitHub Repo Size
// @namespace https://gist.github.com/miraclx/aad03f43fe8ac85682b0243f4f242f0d
// @description Calculate repo size and inject into GitHub page
// @icon https://github.githubassets.com/favicons/favicon.png
// @version 0.2.0
// @author miraclx
// @license Apache-2.0
// @supportURL https://gist.github.com/miraclx/aad03f43fe8ac85682b0243f4f242f0d
// @grant GM_xmlhttpRequest
@miraclx
miraclx / index.html
Created February 15, 2021 03:23
join_split vs split_flat (https://jsbench.github.io/#355b4874bc15a7566433f1976369d984) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>join_split vs split_flat</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@miraclx
miraclx / index.html
Created February 15, 2021 03:34
array accumulation by concat vs push (https://jsbench.github.io/#e27585fe2c271195762d88ecf0188ec3) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>array accumulation by concat vs push</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@miraclx
miraclx / README.md
Created June 7, 2021 13:46
Get info from MTN MF283 on the CLI

Show realtime information from the MTN MF283 Router

Get pretty display for realtime data

One-off query returning JSON data