Skip to content

Instantly share code, notes, and snippets.

View Liam0205's full-sized avatar
🎯
Focusing

Liam Huang Liam0205

🎯
Focusing
View GitHub Profile
@Liam0205
Liam0205 / example.tex
Last active April 15, 2024 05:30
widetext.sty
\documentclass[twocolumn]{article}
\usepackage{mwe}
\usepackage{widetext}
\begin{document}
\blindtext
\begin{widetext}
\[
E = mc^2.
\]
\end{widetext}
@Liam0205
Liam0205 / demo.tex
Last active November 17, 2023 08:13
demo of moderncv
%!TEX program = xelatex
% Font Size:
% 10pt, 11pt, 12pt
% Paper Size:
% a4paper, letterpaper, a5paper, leagalpaper, executivepaper, landscape
% Font Family:
% roman, sans
\documentclass[12pt, a4paper, roman]{moderncv}
% Style:
#include <cassert>
#include <cmath>
#include <iostream>
#include <random>
#include <algorithm>
#include <limits>
#include <functional>
#include <map>
#include <vector>
#include <queue>
@Liam0205
Liam0205 / displayfile
Created April 23, 2018 15:14
displayfile (Skim)
#!/bin/bash
# displayfile (Skim)
#
# Usage: displayfile [-r] [-g] PDFFILE
#
# Modified from "displayline" to only revert the file, not jump to a given line
#
if [ $# == 0 -o "$1" == "-h" -o "$1" == "-help" ]; then
@Liam0205
Liam0205 / 0x00. environment check.sh
Last active June 18, 2023 09:23
XinaminePatcher
if ! type dpkg-deb >/dev/null 2>&1; then
echo "Please install 'dpkg-deb'."
fi
if ! type file >/dev/null 2>&1; then
echo "Please install 'file' from Bingner or Procursus."
fi
if ! type otool >/dev/null 2>&1; then
echo "Please install 'odcctools'."
@Liam0205
Liam0205 / install_procursus.sh
Created June 16, 2023 07:35
Install Procursus on macOS (>= 11)
#!/usr/bin/env bash
set -eu
DARWIN_VERSION=`uname -r | cut -d'.' -f1 | tr -d '\n'`
MIRROR='https://apt.procurs.us'
SUITES='big_sur'
COMPONENTS='main'
procursus_bootstrapped=`if [[ -e '/opt/procursus/.procursus_strapped' ]]; then echo 'true'; else echo 'false'; fi`
@Liam0205
Liam0205 / 00. Feedback.md
Last active May 27, 2023 05:22
Feedback on using Crane with Dopamine.

Environment

  • iPhone 13 Pro
  • iOS 15.4.1
  • Dopamine 1.0.5
  • Choicy 1.4.9
  • Crane 1.3.10
  • Ellekit 1.0

Issues

@Liam0205
Liam0205 / install_vim.sh
Created November 2, 2018 03:17
Compile and install VIM on CentOS 6.x without root.
#!/bin/bash
git clone https://github.com/vim/vim.git --depth=1
cd vim
make -p $HOME/local/bin
./configure --prefix=$HOME/local/vim --enable-multibyte --with-tlib=tinfo --enable-pythoninterp --enable-rubyinterp --with-ruby-command=/usr/bin/ruby --with-features=huge
make -j24
make install
cd $HOME/local/bin
for file in $(ls $HOME/local/vim/bin); do ln -sf $HOME/local/vim/bin/$file $file; done
@Liam0205
Liam0205 / cstring_switch.cc
Last active July 29, 2021 02:15
Apply C style string in switch-case clause in C++. (C++11 or above required)
#include <iostream>
#include <string>
using hash_t = size_t;
constexpr hash_t prime = 0x100000001B3ull;
constexpr hash_t basis = 0xCBF29CE484222325ull;
hash_t hash_run_time(const char* str) {
hash_t ret = basis;
@Liam0205
Liam0205 / access_member_pointer.cc
Last active October 11, 2020 14:56
Implementation of `operator->*` for `std::shared_ptr`
#include <iostream>
#include <functional>
#include <type_traits>
#include <cstddef>
#include <utility>
#include <memory>
namespace yuuki {
template<size_t> // begin with 0 here!
struct placeholder_template