Rust/Go notes
- 
Rustacean and Gopher
- quirky mascot, also Deno?
 
 - 
Rust has borrow, Go has GC
- this is like comparing apples to oranges
 - I won't talk about it here
 
 - 
similar things
 
Rust/Go notes
Rustacean and Gopher
Rust has borrow, Go has GC
similar things
| use libc::memset; | |
| use std::mem::size_of; | |
| use std::time::Instant; | |
| use rand::rngs::SmallRng; | |
| use rand::{Rng, SeedableRng}; | |
| // test a, each call creates its own vec | |
| fn testa(l: usize, m: usize){ | |
| for _ in 0..m { | |
| suba(l); | 
| #!/bin/sh | |
| enum () { | |
| # what happens if you have more than 10 cards? | |
| ls /sys/class/drm/|grep -E '^card[0-9]$' | |
| } | |
| get_hwmon () { | |
| card=$1 | |
| # is it possible to have more than 1 hwmon? | 
| #!/bin/sh | |
| # apt install curl | |
| # obviously change this per your needs | |
| VMID=9001 | |
| STOR=local-lvm | |
| VER=20230124-1270 | |
| URL_PATH=https://cloud.debian.org/images/cloud/bullseye/$VER/ | |
| IMG=debian-11-genericcloud-amd64-$VER.qcow2 | 
| /* fucking ssh-agent, again | |
| we have at least 4 incompatible ssh-agents on windows | |
| there're numerous bridging tools between them but for the love of God I couldn't find the one I need | |
| this thing bridges msys2/cygwin openssh to win32-openssh's ssh-agent | |
| probably the crudest thing you've ever seen, no error handling what-so-ever | |
| if in any rare case you need this too, run this and: | |
| `export SSH_AUTH_SOCK=$LOCALAPPDATA\\ssh-agent-sock` | 
| #!/usr/bin/env python3 | |
| # distilled from https://github.com/jleclanche/python-bna | |
| # only remain functionality is blizzard authenticator serial + restore code => TOTP secret conversion | |
| # so you can use 3rd party TOTP applications | |
| # contained in a single file so it could be audited easily and you don't have to use pip | |
| # and support "CN-" serial courtesy of https://github.com/winauth/winauth/ | |
| import hmac | |
| from base64 import b32encode | 
| #!/bin/sh | |
| # multi SSID with VLAN script, for ASUS AC86U with merlin | |
| # | |
| # setup before hand: | |
| # set "router" to "AP Mode" | |
| # this will put all ports and wireless in br0 | |
| # create 2 guest network | |
| # enable Administration => System => Enable JFFS custom scripts and configs | |
| # put this script in /jffs/scripts/, name should be "services-start" | 
| #!/bin/sh | |
| # call this in cron: /conf/pfsense-dnsmasq-cn.sh > /tmp/dnscn.debug 2>&1 | |
| # it would be nice if pfsense provided some kind of ppp post-up hook interface | |
| PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/sbin | |
| WORKDIR="$(mktemp -d)" | |
| OUTDIR="/conf/dnsmasq.d" | 
| // ==UserScript== | |
| // @name rarbg | |
| // @namespace https://github.com/Jimmy-Z/ | |
| // @version 0.2.0 | |
| // @description rarbg helper (for Movies/x264/1080 and TV HD Episodes) | |
| // @author JimmyZ | |
| // @match *://rarbg.to/torrent* | |
| // @match *://proxyrarbg.org/torrent* | |
| // @grant none | |
| // @updateUrl https://gist.github.com/Jimmy-Z/f24d5a061ba0f7ad45641fd7ee53d819/raw/rarbg.meta.js | 
| /* | |
| * a node.js script to help you make more use of Windows 10 Spotlight lock | |
| * screen images. | |
| * | |
| * Usage: | |
| * node spotlight-export.js <stage dir> <export dir> | |
| * | |
| * What it does: | |
| * --- | |
| * any image in spotlight dir but not in stage dir will be copied to stage dir |