Skip to content

Instantly share code, notes, and snippets.

View zhiyue's full-sized avatar
๐ŸŒป
just do it.

zhiyue zhiyue

๐ŸŒป
just do it.
View GitHub Profile
@zhiyue
zhiyue / youtube-dl.sh
Created November 5, 2020 04:06 — forked from HouCoder/youtube-dl.sh
A shell script for automatic downloading your YouTube playlist.
#!/bin/bash
# Use $ which youtube-dl to get the path.
youtube_dl_path=/usr/local/bin/youtube-dl
# https://askubuntu.com/a/157787
if ps aux | grep -v grep | grep $youtube_dl_path > /dev/null
then
echo "youtube-dl is running"
exit 1
@zhiyue
zhiyue / gist:7c7713bc1fcdc6da876da37f7dcd9d3b
Created July 30, 2020 13:55
Resizing a filesystem using qemu-img and fdisk

Occasionally we will deploy a virtual instance into our KVM infrastructure and realize after the fact that we need more local disk space available. This is the process we use to expand the disk image. This process assumes the following:

  • You're using legacy disk partitions. The process for LVM is similar and I will describe that in another post.
  • The partition you need to resize is the last partition on the disk.

This process will work with either a qcow2 or raw disk image. For

@zhiyue
zhiyue / PVE-Multipath.md
Created July 28, 2020 07:15 — forked from mrpeardotnet/PVE-Multipath.md
PVE-Multipath

Installing multipath tools on PVE Cluster with shared storage

This cheatsheet shows how to install and configure multipath tools on Proxmox PVE Cluster where multiple nodes share single storage with multipath configuration, for example SAN storage connected to each of the nodes by two independent paths.

Proxmox PVE version

This cheatsheet has been tested on Proxmox 5.x.

Note about sudo

I do not prepend sudo command to any of commands listed here, but keep in mind that nearly all commands requires su privileges, so use sudo if your account happen to not have root access.

# applescript
# add login item
osascript -e 'tell application "System Events" to make login item at end with properties {name: "Notes",path:"/Applications/Notes.app", hidden:false}'
# delete login item
osascript -e 'tell application "System Events" to delete login item "itemname"'
# list loginitems
osascript -e 'tell application "System Events" to get the name of every login item'
@zhiyue
zhiyue / k8s-install.md
Created July 4, 2020 11:28 — forked from islishude/k8s-install.md
k8s-ๅ›ฝๅ†…ๆบๅฎ‰่ฃ…

MOVE TO HERE

ๆณจๆ„ไปฅไธ‹ๅ‘ฝไปค๏ผŒ้œ€่ฆๅˆ‡ๆขๅˆฐ root ๅŽ่ฟ่กŒ

ๅฎ‰่ฃ… docker

้ฆ–ๅ…ˆ็กฎๅฎšๅทฒ็ปๅฎ‰่ฃ…ๅฎŒๆˆ docker๏ผŒๅฆ‚ๆžœๆฒกๆœ‰ๅฎ‰่ฃ…ๅฏไปฅไฝฟ็”จไปฅไธ‹่„šๆœฌๅฟซ้€Ÿๅฎ‰่ฃ…ๅนถ้…็ฝฎ๏ผš

@zhiyue
zhiyue / setup.sh
Created June 10, 2020 15:09 — forked from MakiseKurisu/setup.sh
Proxmox VE 6 GPU Passthrough
#!/bin/bash
# Reference guides:
# https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF
# https://pve.proxmox.com/wiki/Pci_passthrough
# https://pve.proxmox.com/wiki/Nested_Virtualization
# Remember to turn on SVM in BIOS and disable CSM
# Update packages
@zhiyue
zhiyue / intel-nvidia.md
Last active April 8, 2021 09:06 — forked from wangruohui/intel-nvidia.md
Intel for display, Nvidia for computing

Intel for display, NVIDIA for computing

This guide will show you how to use Intel graphics for rendering display and NVIDIA graphics for CUDA computing on Ubuntu 18.04 desktop.

I made this work on an ordinary gaming PC with two graphics devices, an Intel UHD Graphics 630 plus an NVIDIA GeForce GTX 1080 Ti. Both of them can be shown via lspci | grep VGA.

00:02.0 VGA compatible controller: Intel Corporation Device 3e92
01:00.0 VGA compatible controller: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] (rev a1)
Debug 15 hrs 15 mins โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 29.3%
TypeScript 12 hrs 6 mins โ–ˆโ–ˆโ–ˆโ–ˆโ–‰โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 23.2%
Other 10 hrs 36 mins โ–ˆโ–ˆโ–ˆโ–ˆโ–Žโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 20.4%
Vue.js 6 hrs 29 mins โ–ˆโ–ˆโ–Œโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 12.5%
JavaScript 4 hrs 36 mins โ–ˆโ–Šโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 8.8%
@zhiyue
zhiyue / System Design.md
Created March 14, 2020 16:14 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?