Skip to content

Instantly share code, notes, and snippets.

View henrybear327's full-sized avatar

Chun-Hung Tseng henrybear327

View GitHub Profile
@henrybear327
henrybear327 / Makefile
Created June 13, 2024 16:24 — forked from APTy/Makefile
Run a makefile command with cleanup
# This file includes example usage and tests for the 'run-with-cleanup' call-able function.
.PHONY: test test-success test-failure main cleanup
-include cleanup.mk
test:
test.sh
main:
@henrybear327
henrybear327 / ARMonQEMUforDebianUbuntu.md
Created June 3, 2024 20:25 — forked from luk6xff/ARMonQEMUforDebianUbuntu.md
Emulating ARM with QEMU on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

If there's no qemu-arm-static in the package list, install qemu-user-static instead

@henrybear327
henrybear327 / phoronix-cmd.md
Created August 30, 2021 00:16 — forked from anshula/phoronix-cmd.md
Phoronix Test Suite Cheat Sheet
@henrybear327
henrybear327 / delete_git_submodule.md
Created February 9, 2021 12:14 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@henrybear327
henrybear327 / latency.txt
Created June 10, 2019 11:47 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@henrybear327
henrybear327 / bibtex.png
Created March 4, 2019 13:57 — forked from max-mapper/bibtex.png
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png
@henrybear327
henrybear327 / Simulated Annealing.go
Created July 20, 2018 06:00
Simulated Annealing for n-queen problem
package main
import (
"flag"
"fmt"
"log"
"math"
"math/rand"
"time"
)
/*
assumptions
1. have 1*1 cells
2. no rotation
3. no overlapping
*/
int greedySolver(vector<Shape> shapes, Floor floorDimension)
{
// generate starting state
@henrybear327
henrybear327 / vpn.md
Created June 10, 2018 11:14 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

(A Russian translation of this article can be found here, contributed by Timur Demin.)

Why not?

@henrybear327
henrybear327 / a.cpp
Last active May 21, 2018 01:16
2018 GCJ Round 2
#include <bits/stdc++.h>
using namespace std;
void solve()
{
int n;
scanf("%d", &n);
vector<vector<char>> ans(111, vector<char>(111, '.'));