Skip to content

Instantly share code, notes, and snippets.

View BoyanXu's full-sized avatar
🎣
Fishing

BoyanXu BoyanXu

🎣
Fishing
View GitHub Profile
@BoyanXu
BoyanXu / login.py
Created November 25, 2020 09:32
login api
@api_view(['POST'])
def login(request):
"""
PATH:
`localhost:8000/api/login/`
Description:
Login request handler.
Request Format: (JSON)
@BoyanXu
BoyanXu / Programmable_Search_Engine_Stylebot.css
Created February 19, 2022 12:51
Programmable_Search_Engine_Stylebot
@import url(https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap);
@import url(https://fonts.googleapis.com/css2?family=Helvetica:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap);
@import url(https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap);
@import url(https://fonts.googleapis.com/css2?family=Muli:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap);
@import url(https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap);
@BoyanXu
BoyanXu / bash_powerline.log
Created March 4, 2022 13:17 — forked from cyruzin/bash_powerline.log
Install Powerline in Arch Linux
# Install powerline and powerline fonts.
sudo pacman -S powerline powerline-fonts
# Optional - Install powerline-fonts-git package from AUR to get the patched fonts.
# Remove the powerline-fonts first then:
sudo pacman -S powerline-fonts-git
@BoyanXu
BoyanXu / .gitconfig
Created March 8, 2022 15:10 — forked from Kovrinic/.gitconfig
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "git@github.com:"]
insteadOf = git://github
@BoyanXu
BoyanXu / get_brew_cellar_full_path.fish
Last active March 8, 2022 16:29
Get Homebrew Installed Formulae's Cellar path
function get_brew_cellar_full_path
set formulae_xby $argv[1]
echo (brew --cellar $formulae_xby)/(brew info --json $formulae_xby | jq -r '.[0].installed[0].version')
end
# $OpenBSD: sshd_config,v 1.104 2021/07/02 05:11:21 dtucker Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
@BoyanXu
BoyanXu / my-posh.json
Last active September 24, 2022 08:09
my-posh.json
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"final_space": true,
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#29315A",
"foreground": "#3EC669",
@BoyanXu
BoyanXu / DHCP
Created October 7, 2022 05:57
DHCP
Server Client Server
(not selected) (selected)
v v v
| | |
| Begins initialization |
| | |
| _____________/|\____________ |
|/DHCPDISCOVER | DHCPDISCOVER \|
| | |
@BoyanXu
BoyanXu / sol6.cpp
Created October 11, 2022 08:23
sol6.cpp
#include <iostream>
#include <unordered_set>
#include <utility>
using namespace std;
class Solution {
public:
vector<pair<int,int>> doubleCheck(vector<int> V) {
unordered_set<int> H;
@BoyanXu
BoyanXu / homebrew-migration-check.fish
Last active May 24, 2023 11:07
Check how many binary files installed through /usr/local/bin/brew are x86-based
#!/usr/local/bin/fish
rm list-of-* 2> /dev/null
## Get list-of-bin, list-of-pkg
exa -al /usr/local/bin | grep Cellar | awk '{ print "/usr/local/bin/" $7}' | sort | uniq >> list-of-bin
exa -al /usr/local/bin | grep Cellar | awk '{ print $9}' | sort | uniq | awk -F'/Cellar/' '{split($2,a,"/"); print a[1]}' | sort | uniq >> list-of-pkg
## Get list-of-arch
while read -la file