Skip to content

Instantly share code, notes, and snippets.

View noyesno's full-sized avatar

Sean Zhang noyesno

View GitHub Profile
@noyesno
noyesno / getline-text-file.tcl
Created May 21, 2021 05:47
文本文件处理 for Tcler : 看一些例子
package require Tcl
proc collext-text-block {line -begin pattern_begin -end pattern_end -buffer listvar body} {
global inside_block
global lines_buffer
if ![info exists inside_block] {
set inside_block 0
set lines_buffer []
@noyesno
noyesno / README.md
Last active February 25, 2019 09:19
LeetCode #20. Valid Parentheses

https://leetcode.com/problems/valid-parentheses/

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

An input string is valid if:

  1. Open brackets must be closed by the same type of brackets.
  2. Open brackets must be closed in the correct order.

Note that an empty string is also considered valid.

@noyesno
noyesno / README.md
Last active February 22, 2019 04:36
LeetCode Problem #1. Two Sum

https://leetcode.com/problems/two-sum/

Given an array of integers, return indices of the two numbers such that they add up to a specific target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

Example:

Given nums = [2, 7, 11, 15], target = 9,
@noyesno
noyesno / git-checkout-index.sh
Last active March 21, 2018 08:27
git checkout index only
git clone -s -n /path/to/repo.git git-tmp
mv git-tmp/.git .
rm -rf git-tmp
# cp .git/refs/remotes/origin/HEAD .git/HEAD
git symbolic-ref HEAD refs/remotes/origin/master
git read-tree HEAD
git status -uno
@noyesno
noyesno / hosts
Created June 23, 2017 15:00 — forked from alswl/hosts
hosts for OpenWRT, for disable AD in xiaomi TV
127.0.0.1 api.ad.xiaomi.com
127.0.0.1 sdkconfig.ad.xiaomi.com
127.0.0.1 ad.mi.com
127.0.0.1 ad.xiaomi.com
127.0.0.1 ad1.xiaomi.com
127.0.0.1 adv.sec.miui.com
127.0.0.1 test.ad.xiaomi.com
127.0.0.1 new.api.ad.xiaomi.com
@noyesno
noyesno / nfs-tuning.md
Last active August 29, 2015 14:26 — forked from denji/nfs-tuning.md
NFS Attribute Caching Performance Impact on Web Applications

A couple of days ago, I had some issues with NFS consistency, not every servers were up to date. Some servers had the good version of the file some hadn’t. However performing a ls -l seemed to fixed tempory the problem after each update (where a simple ls didn’t). Indeed issuing ls with the -l option triggers stat() where ls doesn’t, just because file attributes are called from the stats() function. I needed to investigate…

I. Story

We determined that some web virtual didn’t delivered the same content, some page weren’t updated properly. We quickly figured out that the issue was located of the NFS attribute caching, by default too long, at least in our setup. The first change we made was to enable the noac option on the client mount. However while trying to enhance the consistency of the NFS data, the performance impact was pretty high. The impact was easy to detect and reproduce. Basically everytime a page was request from the webser, the client had to request the NFS server to be sure to del

@noyesno
noyesno / zhihu.recipe
Last active August 29, 2015 14:06 — forked from zellux/zhihu.recipe
#!/usr/bin/env python
__copyright__ = 'Yuanxuan Wang <zellux at gmail dot com>'
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import Tag, NavigableString
from collections import OrderedDict
from contextlib import nested, closing
import json
@noyesno
noyesno / ssh-config
Created June 22, 2014 02:07
SSH Setting for GitHub
# File: ~/.ssh/config
HostName github.com
Host github.com
User git
IdentityFile ~/.ssh/github_rsa
@noyesno
noyesno / labelframe.tcl
Created June 20, 2014 05:32
Demo for Tk widget "labelframe".
wm title . "Tk labelframe Demo"
labelframe .server -text "Server"
labelframe .client -text "Client"
labelframe .log -text "Log"
checkbutton .server.check -text "Server"
.server configure -labelwidget .server.check
checkbutton .client.check -text "Client"
.client configure -labelwidget .client.check
@noyesno
noyesno / 0_reuse_code.js
Created June 20, 2014 02:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console