This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tab(event, obj) { | |
var tabKeyCode = 9; | |
if (event.which) // mozilla | |
var keycode = event.which; | |
else // ie | |
var keycode = event.keyCode; | |
if (keycode == tabKeyCode) { | |
if (event.type == "keydown") { | |
if (obj.setSelectionRange) { | |
// mozilla |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright Dotslash.Lu <dotslash.lu@gmail.com> | |
* | |
* This script runs on Twitter feed pages(home, search results) | |
* and automatically get data including both the feed and the user | |
* then output them in the format of standard API request result | |
* thus bypassing the limit of the Twitter API | |
*/ | |
function O(){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
obj = | |
test: -> | |
subfunc() | |
subfunc = -> | |
null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this won't work | |
var obj = { | |
test: function() { | |
subfunc(); | |
var subfunc = function() {}; | |
} | |
}; | |
// this one works | |
var obj = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env escript | |
%% usage: find_in_dir.erl name dir[ dir2[ ...]] | |
main(P) -> | |
[For|L] = P, | |
{ok, Cwd} = file:get_cwd(), | |
Matches = flatten(lists:map(fun(Dir) -> | |
Absdir = case Dir of | |
"" -> Cwd; | |
[$/|_] -> Dir; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install ovs-dpdk | |
# Copyright Dotslash.Lu <dotslash.lu@gmail.com> | |
# | |
# NOTE: | |
# Please add `iommu=pt intel_iommu=on` to grub bootline and | |
# reboot | |
# | |
# Installation will cause NETWORK LOST, so it's better to | |
# execute this script within an admin console | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import time | |
abspath = os.path.split(os.path.realpath(__file__))[0] | |
sys.path.append("%s/lib" % abspath) | |
import redis | |
import gevent | |
from gevent import monkey; monkey.patch_all() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
struct stack { | |
int val; | |
struct stack *next; | |
}; | |
// find previous node function() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"fmt" | |
"net" | |
"bytes" | |
"unsafe" | |
"encoding/binary" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: bash mon.sh short-hostname | |
# You should first change the node's hostname, e.g. | |
# hostnamectl set-hostname mon1.ceph | |
# Then add it to ~/.ssh/config, e.g. | |
# Host mon1 | |
dst=$1 | |
ssh $dst systemctl stop firewalld | |
ssh $dst systemctl disable firewalld |
OlderNewer