Skip to content

Instantly share code, notes, and snippets.

View xfoxfu's full-sized avatar

Yuze Fu xfoxfu

View GitHub Profile
@Deliay
Deliay / .txt
Last active June 27, 2022 16:55
bilibili-danmaki-dump
# 天选
cmd: ANCHOR_LOT_START, data: {"asset_icon":"https://i0.hdslb.com/bfs/live/627ee2d9e71c682810e7dc4400d5ae2713442c02.png","award_image":"","award_name":"20元红包","award_num":1,"cur_gift_num":0,"current_time":1656347583,"danmu":"黄金甲在线,我就是天选之人","gift_id":31026,"gift_name":"白银宝盒","gift_num":1,"gift_price":1000,"goaway_time":180,"goods_id":15,"id":2808345,"is_broadcast":1,"join_type":1,"lot_status":0,"max_time":600,"require_text":"关注主播","require_type":1,"require_value":0,"room_id":24104755,"send_gift_ensure":0,"show_panel":1,"start_dont_popup":0,"status":1,"time":599,"url":"https://live.bilibili.com/p/html/live-lottery/anchor-join.html?is_live_half_webview=1\u0026hybrid_biz=live-lottery-anchor\u0026hybrid_half_ui=1,5,100p,100p,000000,0,30,0,0,1;2,5,100p,100p,000000,0,30,0,0,1;3,5,100p,100p,000000,0,30,0,0,1;4,5,100p,100p,000000,0,30,0,0,1;5,5,100p,100p,000000,0,30,0,0,1;6,5,100p,100p,000000,0,30,0,0,1;7,5,100p,100p,000000,0,30,0,0,1;8,5,100p,100p,000000,0,30,0,0,1","web_url":"https://live.bilibili.com/p/html/liv

About variadics in Rust

This is an analysis of how variadic generics could be added to Rust. It's not a proposal so much as a summary of existing work, and a toolbox for creating an eventual proposal.

Introduction

Variadic generics (aka variadic templates, or variadic tuples), are an often-requested feature that would enable traits, functions and data structures to be generic over a variable number of types.

To give a quick example, a Rust function with variadic generics might look like this:

anonymous
anonymous / playground.rs
Created October 29, 2017 05:26
Rust code shared from the playground
#[derive(Default, Debug, Clone)]
struct Sth { pub log: Option<Log> }
#[derive(Default, Debug, Clone)]
struct Log { pub access: Option<String> }
fn main() {
let sth = Sth { ..Default::default() };
println!("By default, sth.log.access is not existed, because sth.log is {:?}", sth.log);
@FrankSpierings
FrankSpierings / ipa-resign.sh
Last active February 13, 2023 02:39
IPA Resigning (Frida Injection) Script (OSX)
#!/bin/bash
#
# Script requires `brew`
# - `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
#
# Variables
# - $IPA -> Source IPA
# - $MOBILEPROVISION -> Source embedded.mobileprovision
# find ~/Library/Developer/Xcode | grep embedded.mobileprovision
@lubien
lubien / stickers-downloader.js
Last active November 21, 2023 03:06
Download all visible telegram stickers images
// How to download telegram sticker images
/*
1. Go to Telegram Web;
2. Open console (F12);
3. Paste the code below in the console and press Enter;
4. Open your stickers menu and make sure you see the sticker pack you want to download (so Telegram will load it).
5. At the console paste and run "downloadStickers()" any time you want to download a pack.
6. [Convert .webm to another format](http://www.freewaregenius.com/convert-webp-image-format-jpg-png-format/);
7. Happy hacking.
@mp4096
mp4096 / ppt2pdf.ps1
Created April 28, 2016 10:56
Batch convert PowerPoint files to PDF
# Batch convert all .ppt/.pptx files encountered in folder and all its subfolders
# The produced PDF files are stored in the invocation folder
#
# Adapted from http://stackoverflow.com/questions/16534292/basic-powershell-batch-convert-word-docx-to-pdf
# Thanks to MFT, takabanana, ComFreek
#
# If PowerShell exits with an error, check if unsigned scripts are allowed in your system.
# You can allow them by calling PowerShell as an Administrator and typing
# ```
# Set-ExecutionPolicy Unrestricted
@loderunner
loderunner / osx-ld.md
Last active May 2, 2024 19:43
potential blog posts

ld – Wading through Mac OS X linker hell

Intro

Friend: I tried looking at static linking in Mac OS X and it seems nearly impossible. Take a look at this http://stackoverflow.com/a/3801032

Me: I have no idea what that -static flag does, but I'm pretty sure that's not how you link to a library. Let me RTFM a bit.

Minutes later...

@lgaff
lgaff / boot.asm
Created November 30, 2012 03:02
FAT12 stage 1 boot loader
; incboot.s
; Incrementally build a boot block for x86
; I'm going to keep adding bits to this one step at a time from
; boot-and hang to hopefully loading a kernel
; Here we go.
; We're implementing a FAT12 file system for the boot disk. This file system is well
; documented so it shouldn't be a hard ask for a first-timer like me.
; There is a certain order required for the metadata appearing at the top of the
; boot block below the jump to start, we'll introduce each as we go.