Skip to content

Instantly share code, notes, and snippets.

View SharzyL's full-sized avatar

Sharzy SharzyL

  • Hua University
  • Beijing, China
  • 19:21 (UTC +08:00)
View GitHub Profile
@ksyx
ksyx / README.md
Created December 10, 2021 20:14
A toy that stores some global variables by writing the binary itself

Global Variable Storage

Background

VBA could store some data by simply putting those data into Excel cells or Powerpoint TextBoxes, which is kinda counterintuitive for a programming language to have persist value storage even after stopped running, though perfectly reasonable. Could we do similar thing in the magical C++? This heavily platform dependent toy (ELF + POSIX) achieves this.

Working principle

It simply utilizes the .data segment by either specifying some variables to be put there, or just utilize the fact that initialized values are put there. Some magical operations used:

  • The variables __data_start and edata provided by linker scripts
  • Read output of awk with popen

License

MIT License

@Konano
Konano / huawei.queryLocateResult.py
Last active April 29, 2024 01:47
利用华为的「寻找设备」功能定位手机
import requests
import http.cookiejar as HC
import re, json
import traceback
MOBILE = {
'deviceid': 'xxxxxx',
'hwid_cas_sid': 'xxxxxx',
'useraccount': 'xxxxxx',
'password': 'xxxxxx'
@OceanS2000
OceanS2000 / AdderExample.scala
Created July 20, 2021 16:02
An example with chisel diplomacy
import chipsalliance.rocketchip.config.{Config, Field, Parameters}
import chisel3._
import chisel3.util.log2Ceil
import chisel3.internal.sourceinfo.SourceInfo
import chisel3.stage.ChiselStage
import chisel3.util.random.FibonacciLFSR
import freechips.rocketchip.diplomacy._
import freechips.rocketchip.util.ElaborationArtefacts
import java.io.{File, FileWriter}
@AgentOak
AgentOak / youtube_formats.md
Last active September 11, 2024 20:20
Youtube Format IDs

Last updated: April 2021

Also known as itag or format codes and way back they could be specified with the fmt parameter (e.g. &fmt=22). Depending on the age and/or popularity of the video, not all formats will be available.

DASH video

Resolution AV1 HFR High AV1 HFR AV1 VP9.2 HDR HFR VP9 HFR VP9 H.264 HFR H.264
MP4 MP4 MP4 WebM WebM WebM MP4 MP4
@minjang
minjang / gist:89ee4cd6a040dfda0d7dc23603b3c8c3
Created November 28, 2016 10:41
LLVM -O3 optimization passes
$ ./opt -O3 -debug-pass=Structure -o swap.opt.bc swap.bc
Pass Arguments: -tti -tbaa -scoped-noalias -assumption-cache-tracker -targetlibinfo -verify -simplifycfg -domtree -sroa -early-cse -basicaa -aa -memdep -memoryssa -gvn-hoist -lower-expect
Target Transform Information
Type-Based Alias Analysis
Scoped NoAlias Alias Analysis
Assumption Cache Tracker
Target Library Information
FunctionPass Manager
Module Verifier
Simplify the CFG
@chrisdone
chrisdone / Printf.idr
Last active May 27, 2024 13:01
Type-safe dependently-typed printf in Idris
module Printf
%default total
-- Formatting AST.
data Format
= FInt Format
| FString Format
| FOther Char Format
| FEnd