Skip to content

Instantly share code, notes, and snippets.

@jiayulu
jiayulu / notes.py
Created April 5, 2023 20:56 — forked from IdanBanani/notes.py
some notes i've found
# -*- coding: utf-8 -*-
# To list this file sections: $ grep '^"" ' notes.py
"""""""""""""
"" Why Python ?
"""""""""""""
- extremely readable (cf. zen of Python + [this 2013 study](http://redmonk.com/dberkholz/2013/03/25/programming-languages-ranked-by-expressiveness/))
- simple & fast to write
- very popular (taught in many universities)
- has an extremely active development community
@jiayulu
jiayulu / .spacemacs
Created March 13, 2020 06:39 — forked from howl-anderson/.spacemacs
Automatically switch to English keyboard when leaving insert/replace mode in Evil of Spacemacs. And when you enter insert/replace mode again, switch to whatever input method you used last time. Especially useful when you are using other language (non-english) to write content.
(defun dotspacemacs/user-config ()
(setq shell-file-name "/bin/bash")
; set default var lang_source for ibus arg
(setq lang_source "xkb:us::eng")
; what we do when enter insert mode
(add-hook 'evil-insert-state-entry-hook
(lambda ()
(shell-command (concat "ibus engine " lang_source))))
@jiayulu
jiayulu / latency.txt
Created October 6, 2019 08:39 — 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
@jiayulu
jiayulu / gpgmutt.md
Created May 23, 2019 18:04 — forked from bnagy/gpgmutt.md
Mutt, Gmail and GPG

GPG / Mutt / Gmail

About

This is a collection of snippets, not a comprehensive guide. I suggest you start with Operational PGP.

Here is an incomplete list of things that are different from other approaches:

  • I don't use keyservers. Ever.
  • Yes, I use Gmail instead of some bespoke hipster freedom service
@jiayulu
jiayulu / gpgmutt.md
Created May 23, 2019 18:04 — forked from bnagy/gpgmutt.md
Mutt, Gmail and GPG

GPG / Mutt / Gmail

About

This is a collection of snippets, not a comprehensive guide. I suggest you start with Operational PGP.

Here is an incomplete list of things that are different from other approaches:

  • I don't use keyservers. Ever.
  • Yes, I use Gmail instead of some bespoke hipster freedom service
@jiayulu
jiayulu / Basic_Call_tracking.xml
Created April 13, 2019 05:57 — forked from dtolb/Basic_Call_tracking.xml
BXML For Call Tracking
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<SpeakSentence gender="male" locale="en_US" voice="paul">Thank you for calling Tom's Tire Shop</SpeakSentence>
<Transfer transferCallerId="+19198281234">
<PhoneNumber>+19198281235</PhoneNumber>
<PhoneNumber>+19198281236</PhoneNumber>
<PhoneNumber>sip:[email protected]</PhoneNumber>
</Transfer>
</Response>
@jiayulu
jiayulu / tutorial.md
Created January 27, 2019 06:34 — forked from Hengjie/tutorial.md
How to passthrough SATA drives directly on VMWare ESXI 6.5 as RDMs

How to passthrough SATA drives directly on VMWare EXSI 6.5 as RDMs

There aren't many tutorials about this, the only tutorials I've found were about passing through entire PCIe cards to VMs, or refered to old ESXI versions (below 6.5) that used a more comprehensive desktop client instead of the web app. In v6.5, the web app was introduced and the desktop client was deprecated. You used to be able to setup RDMs in the desktop client, but with the introduction of the web console, this is no longer the case. This tutorial shows you how to pass SATA HDDs to the virtual machine on VMWare ESXI 6.5. This tutorial is partially based on VMWare's own KB and the now deprecated Forza IT blog post.

Summary

We attach the SATA HDDs as a RDM (Raw Device Mapper) into an existing virtual disk in the command line, then on the web app

@jiayulu
jiayulu / i3block-take-a-break.sh
Created January 18, 2019 18:48 — forked from mesuutt/i3block-take-a-break.sh
Break reminder for i3blocks.
#!/bin/bash
#[remind_break]
#command=~/.i3/i3blocks/take-a-break.sh
#interval=10
# Minutes
work_time=20
break_time=5
@jiayulu
jiayulu / ssh-forward-clipboard.md
Created June 28, 2018 20:06 — forked from dergachev/ssh-forward-clipboard.md
Forward your clipboard via SSH reverse tunnels

Exposing your clipboard over SSH

I frequently administer remote servers over SSH, and need to copy data to my clipboard. If the text I want to copy all fits on one screen, then I simply select it with my mouse and press CMD-C, which asks relies on m y terminal emulator (xterm2) to throw it to the clipboard.

This isn't practical for larger texts, like when I want to copy the whole contents of a file.

If I had been editing large-file.txt locally, I could easily copy its contents by using the pbcopy command:

@jiayulu
jiayulu / System Design.md
Created April 4, 2018 05:57 — 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?