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
# 统计代码行数,不包括空行 | |
find /src -name "*.cpp" |xargs cat|grep -v ^$|wc -l | |
# 查看进程内存使用情况 | |
cat /proc/409/status | grep VmRSS | awk '{print $2}' | |
# 获取网卡设备对应的IP地址 | |
ifconfig eth0 | grep "inet " | awk '{print $2}' | |
# 获取网卡设备对应的MAC地址 |
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
1. vscode from https://code.visualstudio.com/ | |
2. ruby 2.6.5 from https://www.ruby-lang.org/zh_cn/, add bin path to /etc/environment | |
3. nodejs from https://nodejs.org/zh-cn/, sudo tar xf xx.tar.gz -C /usr/local, and add bin path to /etc/environment | |
4. sudo visudo, Add ruby and node path to secret path. | |
5. sudo npm install -g yarn | |
6. curl, git, gitg | |
$ git config --global user.name "qichunren" | |
$ git config --global user.email whyruby@gmail.com | |
7. openssh-server | |
8. Set up ssh key with right permisson flag. |
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 pajx_request(url) { | |
Rails.ajax({ | |
url: url, | |
type: "get", | |
success: function (data) { | |
console.log(data); | |
$("#pajx_container").html(data.documentElement.innerHTML); | |
window.history.pushState(null, null, url); | |
}, | |
beforeSend: (xhr, options) => { |
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
#!/bin/bash | |
echo "Start rsync daemon ..." | |
for (( ; ; )) | |
do | |
echo "rsync checking ... [ hit CTRL+C to stop]" | |
rsync -az --exclude 'log/' --exclude 'tmp/' --exclude 'public/' --exclude 'node_modules/' --exclude '.git/' --exclude 'Gemfile.lock' --exclude 'yarn.lock' backend_www xxxxxx@192.168.43.175:/home/xxxxxxx/code/ --delete | |
sleep 3 | |
done |
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
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa | |
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa | |
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa |
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 ruby | |
# -*- coding: utf-8 -*- | |
# | |
# This sample code is a port of | |
# gstreamer/tests/examples/launch/mp3parselaunch.c. It is licensed | |
# under the terms of the GNU Library General Public License, version | |
# 2 or (at your option) later. | |
# | |
# Copyright (C) 2013 Ruby-GNOME2 Project Team | |
# |
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
q = Queue.new | |
producer = Thread.new { | |
c = 0 | |
while true do | |
q << c | |
c += 1 | |
end | |
} | |
printer1 = Thread.new { | |
while true |
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
require 'open-uri' | |
require 'json' | |
require 'time' | |
orders = {} | |
ROUTE_TYPE_CROSS = 7 | |
ROUTE_TYPE_INNER = 3 |
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
############################################################# | |
# | |
# ruby | |
# | |
############################################################# | |
RUBY_VERSION = 1.9.2-p0 | |
RUBY_SITE = ftp://ftp.ruby-lang.org/pub/ruby/1.9 | |
RUBY_AUTORECONF = YES | |
HOST_RUBY_AUTORECONF = YES |
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
sudo ifconfig eth0 192.168.11.187 netmask 255.255.0.0 | |
sudo route add default gw 192.168.8.5 | |
add nameserver 192.168.8.5 to file /etc/resolv.conf | |
cd /media/xubuntu/WD2TB | |
sudo dd if=/dev/sda of=T420HDD-20150506.img |