Skip to content

Instantly share code, notes, and snippets.

View hugefiver's full-sized avatar
😴
Moing (🐟)

Hugefiver hugefiver

😴
Moing (🐟)
View GitHub Profile
@hugefiver
hugefiver / file_magic_numbers.md
Created April 14, 2024 09:15 — forked from leommoore/file_magic_numbers.md
File Magic Numbers

File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

Image Files

@hugefiver
hugefiver / emulator-install-using-avdmanager.md
Created August 12, 2023 19:43 — forked from mrk-han/emulator-install-using-avdmanager.md
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For an emulator that mimics a Pixel 5 Device with Google APIs and ARM architecture (for an M1/M2 Macbook):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-30;google_atd;arm64-v8a"

@hugefiver
hugefiver / oh-my-diana.user.js
Created February 11, 2023 13:21 — forked from journey-ad/oh-my-diana.user.js
在哔站右下角添加嘉然小姐的live2d模型
// ==UserScript==
// @name #相亲相爱一嘉人#
// @description 在哔站右下角添加嘉然小姐的live2d模型
// @version 1.0.1
// @namespace https://github.com/journey-ad
// @author journey-ad
// @include /^https:\/\/(www|live|space|t)\.bilibili\.com\/.*$/
// @icon https://www.google.com/s2/favicons?domain=bilibili.com
// @license GPL v2
// @run-at document-end
@hugefiver
hugefiver / set_proxy.sh
Created December 7, 2022 03:40
set proxy in wsl2
set_proxy() {
export hostip=$(cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }')
local proxy_url="http://${hostip}:7890"
export https_proxy="$proxy_url"
export http_proxy="$proxy_url"
export all_proxy="$proxy_url"
}
unset_proxy() {
export https_proxy="" http_proxy="" all_proxy=""
@hugefiver
hugefiver / !README.md
Created October 13, 2022 07:47 — forked from mmozeiko/!README.md
Download MSVC compiler/linker & Windows SDK without installing full Visual Studio

This downloads standalone 64-bit MSVC compiler, linker & other tools, also headers/libraries from Windows SDK into portable folder, without installing Visual Studio. Has bare minimum components - no UWP/Store/WindowsRT stuff, just files & tools for 64-bit native desktop app development.

Run python.exe portable-msvc.py and it will download output into msvc folder. By default it will download latest available MSVC & Windows SDK - currently v14.32.17.2 and v10.0.22621.0.

You can list available versions with python.exe portable-msvc.py --show-versions and then pass versions you want with --msvc-version and --sdk-version arguments.

To use cl.exe/link.exe from output folder, first run setup.bat - after that PATH/INCLUDE/LIB env variables will be setup to use all the tools as usual. You can also use clang-cl.exe with these includes & libraries.

To use clang-cl.exe without running setup.bat, pass extra /winsysroot msvc argument (msvc is folder name where output is stored).

@hugefiver
hugefiver / profile.ps1
Last active October 16, 2022 10:42
posh env
# Install autocomplete
#Install-Module PSReadLine
# install PSReadLine
#Install-Module -Name PSReadLine
# autocomplete
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
@hugefiver
hugefiver / env.ps1
Created December 30, 2021 06:39
get envs
# machine
$path = [Environment]::GetEnvironmentVariable('ENV_NAME', 'Machine')
[Environment]::SetEnvironmentVariable("ENV_NAME", $newpath, 'Machine')
# user
$path = [Environment]::GetEnvironmentVariable('ENV_NAME', 'User')
[Environment]::SetEnvironmentVariable("ENV_NAME", $newpath, 'USer')
@hugefiver
hugefiver / gpg.sh
Created October 29, 2021 07:10
gpg knowledge
# generate a key pair
gpg --gen-key
# , with choices
gpg --full-gen-key # or `--full-generate-key`
# , need more choice, such as ecc key pair
gpg --full-gen-key --expert
# list keys
gpg --list-keys # ,or shorter `-k`
# , or secret key
@hugefiver
hugefiver / compiler.scm
Created October 28, 2021 02:51
Scheme2llvm compiler - Submitted by Paul on Oct 02, 2012 at 08:41
; A small self applicable scheme->llvm compiler.
;; , Tobias Nurmiranta
;;
;; -- To Use It --
;; Reads scheme-code from standard input.
;; cat code.ss|mzscheme --script compile.ss|llvm-as -f -o=test.bc;lli test.bc
;;
;; The compiler is painfully slow since it for testing purposes
;; compiles all help functions as well (see variable bootstrap).
;; It extends standard scheme with a subset of available
@hugefiver
hugefiver / y.rkt
Last active September 28, 2021 16:31
别老惦记你那破{self}了 scheme
(require lazy)
(((λ (f) ((λ (x) (f (x x))) (λ (x) (f (x x))))) (λ (f) (λ (n) (if (> n 0) (string-append "别老惦记着你那破" (f (- n 1)) "了") "")))) 10)