Skip to content

Instantly share code, notes, and snippets.

nslookup -q=TXT o-o.myaddr.l.google.com. ns1.google.com.
dig -4 TXT +short o-o.myaddr.l.google.com. @ns1.google.com.
nslookup myip.opendns.com. resolver1.opendns.com.
dig -4 A +short myip.opendns.com. @resolver1.opendns.com.
nslookup whoami.akamai.net. ns1-1.akamaitech.net.
dig -4 A +short whoami.akamai.net. @ns1-1.akamaitech.net.
curl -s https://api.ipify.org
@m1el
m1el / utf8.rs
Created December 18, 2023 20:15
fn utf8_len(start: u8) -> usize {
match start {
0b0000_0000..=0b0111_1111 => 1,
0b1100_0000..=0b1101_1111 => 2,
0b1110_0000..=0b1110_1111 => 3,
0b1111_0000..=0b1111_0111 => 4,
_ => 0,
}
}
enum Utf8Error {

Win-R <thing> to open these folders quickly:

  • shell:AccountPictures%AppData%\Microsoft\Windows\AccountPictures
  • shell:AddNewProgramsFolderControl Panel\All Control Panel Items\Get Programs
  • shell:Administrative Tools%AppData%\Microsoft\Windows\Start Menu\Programs\Administrative Tools
  • shell:AppData%AppData%
  • shell:Application Shortcuts%LocalAppData%\Microsoft\Windows\Application Shortcuts
  • shell:AppsFolderApplications
  • shell:AppUpdatesFolderInstalled Updates
  • shell:Cache%LocalAppData%\Microsoft\Windows\INetCache
use std::arch::asm;
#[inline(always)]
fn pdep_u64(x: u64, mask: u64) -> u64 {
let mut _rv: u64;
unsafe {
asm !{
"pdep {out}, {x}, {mask}",
out = out(reg) _rv,
x = in(reg) x,
@m1el
m1el / 01_download.py
Created October 15, 2018 22:07
downloading weather data because Mr. Grey is too lazy
import requests
url = 'https://api-ak.wunderground.com/api/d8585d80376a429e/history_{:04}{:02}{:02}{:04}{:02}{:02}/lang:EN/units:english/bestfct:1/v:2.0/q/EGLL.json?showObs=0&ttl=120'
for year in range(1996, 2018+1):
print(url.format(year, 8, 1, year, 8, 31))
text = requests.get(url.format(year, 8, 1, year, 8, 31)).text
with open('{}-08.json'.format(year), 'w+') as fd:
fd.write(text)
<img/src/onerror=alert(1)>
@m1el
m1el / invoker-2.md
Last active November 28, 2022 13:45
Old Invoker skills

Quas

Builds Kael's skill in the arcane magics. These spells, when invoked, deal with the power of the mind, wind, and water. As a reagent, increases damage by 2% per level, per reagent cast. increases Intelligence by 1 each time skill is learned.

// Implements the cool-lex algorithm to generate (n,k)-combinations
// @article{Ruskey:2009fk,
// Author = {Frank Ruskey and Aaron Williams},
// Doi = {10.1016/j.disc.2007.11.048},
// Journal = {Discrete Mathematics},
// Month = {September},
// Number = {17},
// Pages = {5305-5320},
// Title = {The coolest way to generate combinations},
// Url = {http://www.sciencedirect.com/science/article/pii/S0012365X07009570},
// https://godbolt.org/z/KoMfsEszq
// https://godbolt.org/z/18PKTE6Ej
// https://godbolt.org/z/vGs9Eeoo5
// Base on Hacker's Delight section 2.3 THE 16 BINARY LOGICAL OPERATIONS
#![feature(portable_simd)]
extern crate core;
#[repr(u8)]
#![feature(portable_simd)]
/// A multiplier constant which shifts each bit of a byte into the lowest
/// bit of the corresponding byte in u64. Constant calculation:
/// `(0..8).fold(0, |acc, x| acc | (1 << ((8 + 1) * x)))`
const PACK_BYTES: u64 = 0x8040201008040201;
/// Retain only the lowest bit in each byte of u64, making it a valid [bool; 8].
/// Constant calculation: `(0..8).fold(0, |acc, x| acc | (1 << (8 * x)))`
const BOOL_MASK: u64 = 0x0101010101010101;