Skip to content

Instantly share code, notes, and snippets.

View shufengh's full-sized avatar
🎯
Focusing

Shufeng shufengh

🎯
Focusing
View GitHub Profile
@shufengh
shufengh / fix-linux-docker-perm.sh
Created February 27, 2020 01:38
fix-linux-docker-perm.sh
if your docker complains about permission denied to access a socket, try
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
# Fix existing permission issues
sudo chown "$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R
@shufengh
shufengh / LocalStorageExport.md
Created July 11, 2019 05:23
How to export content in Chrome's local storage for a website

Original idea is from this post

  1. Open a tab and navigate to the website where you have content to export.

  2. Open devtools and switch to the console tab.

  3. Copy and paste the following snippet in the console and Chrome should ask you to save the output file

var obj = JSON.stringify(localStorage, null, 4)
@shufengh
shufengh / System Design.md
Created January 19, 2019 08:37 — 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?
@shufengh
shufengh / gopoly.py
Created November 15, 2014 02:27
A scrapper to download UNMASKED pictures from http://images.partypics.com/events/
#!/usr/bin/python
# Have fun -sh
import sys, urllib, os, time
FUN=1
PICS=10
IMGURL = "http://images.partypics.com/events/"
if len(sys.argv) != 2:
I saw these questions in other places and think it may be worth a try.
Question 1:
Given a finite set of unique numbers, find all the runs in the set.
Runs are 1 or more consecutive numbers.
That is, given {1,59,12,43,4,58,5,13,46,3,6},
the output should be: {1}, {3,4,5,6}, {12,13}, {43}, {46},{58,59}.
Note that the size of the set may be very large.
If you think it's too easy, you can take a look at the discussion here: