Skip to content

Instantly share code, notes, and snippets.

View megrxu's full-sized avatar
🏠
Working from home

megrxu

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am megrxu on github.
  • I am xugr (https://keybase.io/xugr) on keybase.
  • I have a public key ASA2varSE_NbeEIqds2KomH1yuIOFpt9cvDR_8EtjcfApQo

To claim this, I am signing this object:

@megrxu
megrxu / greeting.sh
Last active April 29, 2022 08:14
Message of one day.
#!/bin/bash
#define the filename to use as output
motd="/tmp/motd"
# Collect useful information about your system
# $USER is automatically defined
HOSTNAME=`uname -n`
KERNEL=`uname -r`
CPU=`cat /proc/cpuinfo | grep 'model name' | uniq | cut -f2 -d":"`
ARCH=`uname -m`
# The different colours as variables
@megrxu
megrxu / site.conf
Created July 26, 2017 00:50 — forked from XiangpengHao/site.conf
A simple Nginx config template
server{
listen 80;
server_name file.zjuqsc.com;
return 301 https://$host$request_uri;
}
server {
listen 12081;
listen 443 ssl http2;
server_name file.zjuqsc.com;
ssl_certificate /srv/ssl/file.zjuqsc.com.crt;
@megrxu
megrxu / slides.tex
Created December 28, 2017 08:22
A beamer template.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Beamer Presentation
% LaTeX Template
% Version 1.0 (10/11/12)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
@megrxu
megrxu / gh-pages-deploy.sh
Created February 26, 2018 10:56
deploy the gh-pages from a hugo site folder
#!/bin/bash
echo -e "\033[0;32mDeploying gh-pages to GitHub...\033[0m"
# Clean
rm -rf public
# Build the project.
hugo # if using a theme, replace with `hugo -t <YOURTHEME>`
@megrxu
megrxu / crop-matlab-figure.m
Created June 27, 2018 12:48
Exporting a figure in Matlab to PDF often outputs a A4-sized pdf file. This snippet can export an standalone pdf which can be used in TeX file directly.
% Exporting a figure in Matlab to PDF often outputs an A4-sized pdf file. This snippet can export a minimal size pdf which can be used in TeX files directly.
% some figures here
figure;
plot(zeros([1, 5]));
% codes that works
fig = gcf;
fig.PaperPositionMode = 'auto';
fig_pos = fig.PaperPosition;
@megrxu
megrxu / settings.json
Created February 23, 2019 12:39
latex-workshop
{
"latex-workshop.latex.recipes": [{
"name": "latexmk-thesis",
"tools": [
"latexmk-thesis",
]
}],
"latex-workshop.latex.tools": [{
"name": "latexmk-thesis",
"command": "latexmk",
@megrxu
megrxu / client-config.json
Last active April 11, 2024 23:57
v2ray | WebSocket + VMess/VLess + TLS
{
"inbounds": [
{
"port": 1080,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"udp": false
}
}
@megrxu
megrxu / config.yml
Created March 14, 2019 01:07
Circle CI config for Hugo + GitHub Pages + Custom Domain
version: 2
workflows:
version: 2
build:
jobs:
- build
- deploy:
requires:
- build
@megrxu
megrxu / build.yml
Last active March 6, 2024 14:16
A GitHub Actions workflow configuration to build TeX files with extra fonts.
name: Build
on: [push]
jobs:
build_latex:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v1
- name: Install TeX Live packages # (Note that you may don't need some of them)
run: sudo apt install -y texlive-base texlive-xetex texlive-lang-chinese latexmk