Skip to content

Instantly share code, notes, and snippets.

View Sailfishc's full-sized avatar
🎯
Focusing

张成 Sailfishc

🎯
Focusing
View GitHub Profile
@Sailfishc
Sailfishc / youtube-dl.md
Created April 5, 2020 02:49
Using youtube-dl to download courses from Pluralsight

Download courses from learning sites with youtube-dl

You can download whole courses from an array of tutorial sites with the CLI tool youtube-dl. In the example further down I'm using my Pluralsight account to get videos from a course at their site. Here is a list of all supported sites that you can download from with this tool

The flags you have to supply may vary depending on which site you make a request to.

You can get a free 3 month trial to Pluralsight by signing up for free to Visual Studio Dev Essentials

Installation

@Sailfishc
Sailfishc / leetcode_retag.md
Created December 13, 2019 08:27 — forked from Windsooon/leetcode_retag.md
Retag most popular Leetcode problems
@Sailfishc
Sailfishc / present.zsh-theme
Created December 8, 2019 13:59 — forked from BretFisher/present.zsh-theme
oh-my-zsh theme for presentations (hides prompt features based on path)
# problem: when presenting, I want to obscure
# my prompt to act like it's at root of file system
# and be very basic with no git info, etc.
# solution: this theme lets you set a ENV to the path
# of your presentation, which will help remove unneeded prompt
# features while in that path
# oh-my-zsh theme for presenting demos
# based off the default rubbyrussell theme
@Sailfishc
Sailfishc / latency.txt
Created September 23, 2019 04:56 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@Sailfishc
Sailfishc / install-vagrant-vbguest.sh
Created March 25, 2019 07:18 — forked from lotreal/install-vagrant-vbguest.sh
解决中国局域网中 vagrant plugin install vagrant-vbguest 出错的问题
#!/usr/bin/env bash
GEMS=$(cat <<EOF
childprocess-0.5.8.gem
ffi-1.9.10.gem
little-plugger-1.1.4.gem
micromachine-1.1.0.gem
multi_json-1.11.1.gem
net-ssh-2.9.2.gem
rest-client-1.6.9.gem
@Sailfishc
Sailfishc / zshrc
Created March 15, 2019 05:09 — forked from hellokaton/zshrc
my zshrc
# I you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/biezhi/.dotfiles/zsh
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
#ZSH_THEME="robbyrussell"
#ZSH_THEME="ys"
@Sailfishc
Sailfishc / mac-multiple-version.md
Created March 15, 2019 05:08 — forked from hellokaton/mac-multiple-version.md
mac下多个jdk版本共存

修改系统环境变量,以自如的切换多个版本的 jdk

vi ~/.bash_profile 并填写下文内容
source ~/.bash_profile // 刷新环境变量
java -version // 查看当前的 jdk 版本

需要填写的内容为:

@Sailfishc
Sailfishc / git_upstream.md
Created March 15, 2019 05:08 — forked from hellokaton/git_upstream.md
保持fork之后的项目和上游同步

开源协作,为了规范,一般都是 fork 别人的仓库到自己帐号下,再提交pr,原始仓库一直保持更新,下面介绍如何保持自己fork之后的仓库与上游仓库同步。

下面以我 fork Blade 仓库为例

点击 fork 到自己帐号下,然后就可以在自己的帐号下 clone 相应的仓库

使用 git remote -v 查看当前的远程仓库地址,输出如下:

origin git@github.com:biezhi/blade.git (fetch)
@Sailfishc
Sailfishc / ImageUtil.java
Created March 15, 2019 05:08 — forked from hellokaton/ImageUtil.java
图片压缩工具类
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
@Sailfishc
Sailfishc / mysql_back.sh
Created March 15, 2019 05:07 — forked from hellokaton/mysql_back.sh
在 Linux 上定时备份 MySQL 数据库,并发送备份到邮件
#!/bin/sh
#this is the prefix before the filename and can be anything you want
fileprefix='mysql_backup_';
#this is your mysql user - best to create a new mysql user called backup that has access to all databases
myuser='backup';
#your mysql password
mypass='s0mething$ecure123';