Skip to content

Instantly share code, notes, and snippets.

View paseaf's full-sized avatar
🚶
Go Go Go!

Ziyang paseaf

🚶
Go Go Go!
View GitHub Profile
@paseaf
paseaf / zotero_on_fedora.md
Last active October 29, 2022 14:03
Install Zotero to Fedora
  1. Download and untar binary from official website
  2. Put the untared directory to your expected folder ($HOME/Application/Zotero here)
  3. Create a .desktop file at $HOME/.local/share/applications
[Desktop Entry]
Name=Zotero
Icon=$HOME/Applications/Zotero/chrome/icons/default/default256.png
Comment=Open-source reference manager (standalone version)
Exec=$HOME/Applications/Zotero/zotero
@paseaf
paseaf / gcp_add_default_firewall_rules.md
Last active June 14, 2022 17:14
Add GCP default firewall rules

Rules: https://cloud.google.com/vpc/docs/firewalls#more_rules_default_vpc

Add them with gcloud:

gcloud compute firewall-rules create default-allow-internal --allow tcp:0-65535,udp:0-65535,icmp \
  --source-ranges="10.128.0.0/9" --priority=65534
gcloud compute firewall-rules create default-allow-ssh --allow tcp:22 --priority=65534
gcloud compute firewall-rules create default-allow-rdp --allow tcp:3389 --priority=65534
gcloud compute firewall-rules create default-allow-icmp --allow icmp --priority=65534
@paseaf
paseaf / update_vmware_fedora.sh
Last active November 11, 2022 09:40
Update VMWare Player after kernel update - Fedora
#!/bin/bash
set -euxo pipefail
VMWARE_VERSION=$(vmplayer -v 2>/dev/null | grep VMware | awk '{ print $3}')
TMP_DIR="/tmp/vmware_update"
mkdir -p $TMP_DIR
cd $TMP_DIR
wget "https://github.com/mkubecek/vmware-host-modules/archive/workstation-$VMWARE_VERSION.tar.gz" \
@paseaf
paseaf / blinking_LED.ino
Created April 30, 2022 19:58
arduino blinking LED with different frequencies
const float femaleMaleRatio = 95.0/65;
const int maleLight = 3; // PIN
const int maleBrightness = 190; // brightness for male light. value should be in [0, 255]
const int maleInterval = 500; // after how many ms the male light should be switched on/off
const int femaleLight = 11; // PIN
const int femaleBrightness = maleBrightness * femaleMaleRatio;
const int femaleInterval = maleInterval * femaleMaleRatio;
@paseaf
paseaf / linux_machine_setup.md
Last active June 2, 2023 10:42
Personal Linux Setup

Linux Machine Setup

Personal Linux setup

Tools to install

  1. VS Code

  2. Git:

    sudo add-apt-repository ppa:git-core/ppa -y
    sudo apt update; sudo apt install git
@paseaf
paseaf / hyper_v_how-tos.md
Last active January 6, 2023 08:20
Hyper-V Linux on Windows How-Tos

Hyper-V How-Tos

Set up a Static IP for Hyper V guest OS

Motivation: to ssh to the VM without always figuring out what the VM's current IP is.

Windows' default switch dynamically assigns IP address to Hyper V Vms whenever Windows restarts.
To assign a static IP address to a VM, we need to set up an Internal Switch.

Steps:

@paseaf
paseaf / openvpn_setup.md
Last active January 29, 2022 17:07
Set up an OpenVPN Server and Client

On a Linux Server machine

curl -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh
chmod +x openvpn-install.sh
./openvpn-install.sh

Select add a client, and give it any name you like. A your_client_name.ovpn will be generated in the home folder.

Read more here: https://github.com/angristan/openvpn-install#usage

@paseaf
paseaf / code_smells_and_solutions.md
Last active May 15, 2024 15:36
Code Smells and Solutions

Definition (Code Smells) Code smells are common code anti-patterns which could and should be refactored.

This doc is summarized from Martin Flower's book Refactoring (the 2nd Edition).

Refactoring is all about Change

  • You may inverse previous refactorings as software grows
  • You may change names of a function/parameter/varible/... as you learn

How to use this doc

Go to a section of code smell, and the refactoring techniques to that smell are written in Pascal Case under the Solution section. Refer to the book's catalog to get detailed examples and explainations for each refactoring technique.

Table of Code Smells

@paseaf
paseaf / PULL_REQUEST_TEMPLATE.md
Last active April 16, 2021 20:41 — forked from adavis/PULL_REQUEST_TEMPLATE.md
Sample Pull Request template for use on GitHub

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Fixed #issue

Type of Change

Please delete options that are not relevant.