
Linux
文章平均质量分 54
蜜汁小强
年龄怎么就突然变大了呢
展开
-
苹果电脑一键测网速
推荐一个测速脚本:curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -执行一下试试:$ curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | py...原创 2019-01-21 10:41:42 · 1036 阅读 · 0 评论 -
shell script of downloading vim plugin for Linux OS
Below shows the script:#!/bin/bashlog() { printf "[%24s] --- : $1\n" "$(date +"%Y-%m-%d %H:%M:%S.%6N")"}log "install pathogen.vim"test -f ~/.vim/autoload/pathogen.vim || { mkdir -p ~/原创 2014-06-10 23:41:19 · 947 阅读 · 0 评论 -
装机必备 | Ubuntu 14
搭建Vim文本编辑器搭建SSH服务搭建原创 2014-06-05 21:42:27 · 3436 阅读 · 0 评论 -
我的Linux $PS配置(命令行提示样式)
配置~/.bashrcPS1='\e[33m[\u@\h:\w]\e[0m\n$'PS2='> 'PS4='+ '显示效果:[xiwang@Linux01:~/tasks/]$原创 2012-06-14 09:58:03 · 1544 阅读 · 0 评论 -
Setup a Subversion server in three minutes
IntroductionI assume you are using Linux and having subversion installed, then you will follow the steps to setup a subversion server with URL looks like svn://localhost/reponameSetup1. Create a原创 2013-10-23 22:07:28 · 1236 阅读 · 0 评论 -
Build Android-C App with NDK
Here we are going to build an APP with NDK for Android, we will use Makefile during the building.File --- Makefile# --- Begin Customized --- BIN = testCUSTOM_OBJS = $(shell find . -name '*.c' |原创 2013-08-08 23:11:31 · 2142 阅读 · 0 评论 -
Install Ubuntu 13 and Android ADT in Win7 for 64 bits PC
Step1: Install Ubuntu to real diskWhat ever, we need to install Ubuntu into disk. I use EasyBCD 2.2 to help install Ubuntu.After the installation, we may meet an issue of booting for Ubuntu system原创 2013-07-28 21:37:22 · 1318 阅读 · 0 评论 -
bash脚本(bashmap):一个拟补bash没有hashmap的函数
步骤1:把函数加入bash脚本中(或.bashrc)# for bashmap {# echo md5 code for $1md5(){ if [ X"$1" == X"" ] then echo "" else echo "$1" | md5sum - | cut -c 1-32 fi}# Usage# > bashmap "key" "v原创 2013-07-18 20:22:23 · 3074 阅读 · 0 评论 -
Common functions for BASH SCRIPT
A Demo to process command line arguments.#!/bin/bash# -----------------------------------------------------------------------------# config item list# -----------------------------------------原创 2013-05-08 17:58:42 · 910 阅读 · 0 评论 -
[C++] [Source Code] Tracebin: Get text as Hex String.
I'd written an article [http://blog.youkuaiyun.com/wxqee/article/details/7644831] about this title. Here is the upgrade version as C++. It has been tested in Linux, you can just copy & paste the source c原创 2013-02-01 14:23:48 · 1350 阅读 · 0 评论 -
Linux - C++ - Print log to file
Reversion 1: #include #include #include #include int main (int argc, char **argv){ std::stringstream logf_n; logf_n << "/tmp/MyApp_" << time(0) << ".log"; std::ofstream logf(logf_原创 2013-01-29 16:32:28 · 1806 阅读 · 0 评论 -
BASH 文本模版的简单实现 micro_template_compile
具体代码################################# Funciton: micro_template_compile## Parameter:# [1] => template :String# [2..n] => values for placeholder as key=value## Example:# <- micro_tem原创 2014-06-17 11:48:35 · 1706 阅读 · 0 评论 -
如何使用 vimdiff 来 git diff
$ git config --global diff.tool vimdiff$ git config --global difftool.prompt false$ git config --global alias.d difftool翻译 2014-06-13 10:49:25 · 9329 阅读 · 1 评论 -
Shell Script: 查找某个目录某个时间以后的所有文件
问题描述经常游走于 Linux 的文件海洋中,常常需要查找某个时间以后的所有文件。有可能你要打包他们,也有可能只是查看。问题是,想写一个脚本 find-newer 放在服务器上,怎么做呢?目标使用一条这样的命令,就可以查找出 2018年1月27日19点以后的 ./wp-content 目录下的所有文件!find-newer 201801271900 ./wp-content原创 2018-01-27 01:19:20 · 3463 阅读 · 0 评论 -
用 SSHFS 绑定远端目录(断网自动重连)
首先要确保 sshfs 命令已经安装成功(安装方法可以百度一下),通过命令可以查看:>>> sshfs --versionSSHFS version 2.5 (OSXFUSE SSHFS 2.5.0)OSXFUSE library version: FUSE 2.7.3 / OSXFUSE 2.7.5no mount pointMount(绑定) 一个远端目录到本地目录: (mkdir原创 2015-12-24 19:00:55 · 8236 阅读 · 0 评论 -
Node.js 本地版本控制
Node.js 本地版本控制述求通过 Node.js 官网或其他渠道安装的 Node.js 可能并不是我们当前想要的版本,例如我们在 meteor@1.1+ 进行开发的时候,最好采用 node@0.10.40 这个版本的 node.js.n 工具$ sudo npm install -g n$ sudo n 0.10.40 # => 安装 node@0.10.40想本用户专用的 node.js原创 2015-10-09 21:29:23 · 1665 阅读 · 0 评论 -
SSH Tunnel 一般场景用法
SSH TunnelSSH Tunnel 顾名思义就是 SSH 安全隧道,平时看别人的相关帖子的时候很多时候可能看不太明白讲的是几个意思,这里我们约定一下说法的含义:“ HostA 可以访问 HostB ” 意思是在机器 HostA 上,可以通过 SSH Client 远程登陆到机器 HostB 上。下边 Sequence 图中,箭头方向就是机器间可以访问的方向。下边 Sequence 图中,原创 2015-10-19 00:19:37 · 89864 阅读 · 2 评论 -
Linux 监控一个目录的变更
文件监控工具 inotify-tools在Linux下载并安装工具 inotify-tools 。Ubuntu 下安装:sudo apt-get install inotify-tools例子假设工程文件都放在 src/ 中,并且想监控此文件夹中的所有文件变更、创建、删除操作。main() { local folder="src/" local file_4_changes="/tmp/wat原创 2015-11-03 21:06:09 · 2265 阅读 · 1 评论 -
VIM 简要配置(IDE)
VIM首先需要获取一个 vim 编辑器,这里以 Linux 作为前提。VIM 包管理插件使用 pathogen 插件作为插件管理,这样可以避免众多插件在目录结构集中到了一起的问题。在Shell Terminal下的任何位置,执行如下命令:mkdir -p ~/.vim/autoload ~/.vim/bundle && \curl -LSso ~/.vim/autoload/pathogen.vi原创 2015-07-16 14:48:30 · 1894 阅读 · 0 评论 -
BASH Shell 简易进度条小函数
不多说,直接上脚本。# processbar processbar() { local current=$1; local total=$2; local maxlen=80; local barlen=66; local perclen=14; local format="%-${barlen}s%$((maxlen-barlen))s" local perc="[$cu原创 2014-08-01 10:16:59 · 5911 阅读 · 0 评论 -
bash shell 监控 coffee, jade 脚本以便及时自动编译
假设场景:开发工程目录下有 node.js 文件 server.js,以及 coffee/ 目录和 jade/ 目录,俩目录包含子目录和相应的 *.coffee 和 *.jade 文件,这时如何监控 coffee/ 和 jade/ 以便及时编译到 public/ 发布目录上呢?Bash Shell 脚本:#!/bin/bashcd `dirname $0`jade原创 2014-07-30 21:13:02 · 1215 阅读 · 0 评论 -
bash 脚本实现的配置文件(ini/inc.sh)的读写操作
这两个bash 函数是以前写的,目的是对一个已经存在的ini配置文件进行修改和读取,当然实在Linux Bash Shell下进行的:例如一个配置文件 config.ini# config.ininame = xiwangage = 27执行脚本,修改name=xiwang为name=Xiaoqiang Wang(Eric),期望的输出:xiwang@ubuntu:~原创 2012-06-08 10:00:47 · 9630 阅读 · 0 评论 -
BASH 脚本制作简单 Workflow - 更新 2014/6/17 12:00
因为需要,我创建了一个脚本叫 wf.sh (随意起什么名字),它可以读取当前目录下的 config.ini 配置文件来解析并执行工作流任务(Workflow)。直接上代码:config.iniWorkflow.Name = exampleWorkflow.Description = my work flow example \n and I know what's g原创 2014-06-17 11:21:26 · 2152 阅读 · 0 评论 -
Db class for PHP
Cut from: http://www.oschina.net/code/snippet_96541_3441Db class for PHP<?phpClass DB { private $link_id; private $handle; private $is_log; private $time; //构造函数 public function __constru转载 2012-12-20 23:32:29 · 2575 阅读 · 0 评论 -
Echo dependencies of an installed rpm package over Linux bash shell
Script:#!/bin/bash# File: rpmdeps.sh#set -xRTVAL=0; export RTVALcd `dirname $0`WORKDIR=$PWD; export WORKDIRtest ! -z "$1" || { echo "Error, RPM name is required." exit 1}TMPFILE=原创 2012-12-19 13:44:37 · 691 阅读 · 0 评论 -
bash 脚本写的“抓阄程序”(随机数)
刚才想着抓阄,又懒着去找笔,就顺手写了一个抓阄的脚本:使用前创建一个抓阄项目的文件,比如,我想以后着重研究“C/C++"、"Java"、"Python"中的一个,首先创建一个随便什么名字的文件:xiwang@ubuntu:~/Dev/DrowLots$ cat records.txtC/C++JavaPython然后运行脚本:xiwang@ubu原创 2012-06-16 22:35:02 · 3774 阅读 · 0 评论 -
Linux SSH 服务器的安装和启动
在Ubuntu Linux中,安装 SSH 和 SSH SERVER 可以使用命令:sudo apt-get install ssh openssh-server启动 SSH SERVER 命令:/etc/init.d/ssh start相关下载:PUTTY及其维护的产品: http://www.putty.org/原创 2012-06-16 00:17:21 · 3215 阅读 · 0 评论 -
Linux下对已有项目快速打RPM包(只需编辑XML文件)
期间公司在做Migration的工作,经常遇到这样的场景:需要对现有的二进制第三方库和头文件打包成RPM包,以便临时测试用或者第三方库管理。但是,修改SPEC文件并编写Makefile是个郁闷的事情,总是重复去做,对RPM新手来说是个灾难。于是乎,小强就创建了一个开源项目RPMBuilder来完成这件事相对郁闷的事情,理由很简单,每个童鞋只要下载、编译、安装RPMBuilder以后,就原创 2012-06-07 23:17:32 · 2908 阅读 · 0 评论 -
简单的、智能搜索源文件的 Makefile
如果,你正在为寻找一个通用简易的、智能搜索源文件的 Makefile 而奔波的话,那么下边的Demo你有可能看得上它:例如,你有一个目录,这个目录里目前只是生成一个二进制文件,其源码全部在这里,那么你可以尝试第一个版本的 Makefile# Makefile, 2012-06-15 T1738# TODO# ----------------------------------原创 2012-06-15 18:06:11 · 2063 阅读 · 0 评论 -
如何让linux启动后自动进入图形界面或不让它进入图形界面?
转自:http://www.cnblogs.com/helloBreak/archive/2011/09/03/2165897.html方法一:To 3 字符[root@15 system]# rm -rf /etc/systemd/system/default.target[root@15 system]# ln -s /lib/systemd/system/runlevel3转载 2012-06-14 22:20:11 · 13534 阅读 · 0 评论 -
Linux常用命令大全
// Linux常用命令大全.txt//// @history// *2012-6-11 01:40PM init, 转自 http://www.php100.com/html/webkaifa/Linux/2009/1106/3485.html// 系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2)转载 2012-06-11 13:47:48 · 807 阅读 · 0 评论 -
[C/C++] Using `getopt' in c/c++
Using `getopt' in c/c++Could not get the real original version for the examples, list one of them first, usefully and well tested.ExamplesExample 1// getopt_example.cpp#include int m转载 2012-06-08 14:00:08 · 1198 阅读 · 0 评论 -
Process options from command line in BASH
Have you ever met thus kind of requirement:Use BASH to write a script with options to implements some functions??For example, here is the requirement.. "We need a script in BASH to get its options原创 2012-06-08 13:07:45 · 854 阅读 · 0 评论 -
How to Use `strace` to Trace the System Call in Linux
Howto:Use `strace` to trace system calls for a runtime app:# @option -T 显示每一调用所耗的时间.# @option -t 在输出中的每一行前加上时间信息.# @option -p 追踪某一个PID的进程.# @option -x 无法显示的字符,用16进制输出.> strace -T -t -p -原创 2012-06-08 11:47:22 · 1083 阅读 · 0 评论 -
Tracebin in C++
Core filestracebin.h// tracebin.h#ifndef _TRACE_BIN#define _TRACE_BIN#include #include extern int ftracebin(FILE* pf, const char* data, int length);extern int tracebin(const char* data,原创 2012-06-08 11:54:38 · 1077 阅读 · 0 评论 -
简单的、智能搜索源文件的 Makefile(随意扩展bin或lib)
上一期: 《简单的、智能搜索源文件的 Makefile》下载代码:http://download.youkuaiyun.com/detail/wxqee/4377256包括《简单的、智能搜索源文件的 Makefile》和本期《简单的、智能搜索源文件的 Makefile(随意扩展bin或lib)》的代码。过了一天,过来写一个模版,其预期的场景是这样的:同一个工程下,需要编译一原创 2012-06-16 20:21:33 · 1551 阅读 · 0 评论 -
BASH脚本(ok2makefile):生成带有makefile的C++ "Hello world"程序
这个脚本也是闲着没事儿准备以后用的,应用场景:“在Linux下开发C++项目的时候,有时候需要临时创建一个简单的C++工程来尝试一些用法,但是全新编写一个带有makefile的hello world还是需要几分钟时间的,也是个反复的活儿,要是有个命令能够一下子生成一个目录,里边含有main.cc和makefile就好了。”如果你也会经常遇到这种场景,到可以试试ok2makefile.sh脚本,原创 2012-06-24 21:07:46 · 1619 阅读 · 0 评论 -
Valgrind: a toolkit of command check over Linux/Unix
Downloadwget http://www.valgrind.org/downloads/valgrind-3.8.1.tar.bz2Memory check: leak check# File: ~/.bashrcalias vgmem='valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --log-f原创 2012-12-17 10:04:15 · 662 阅读 · 0 评论 -
Install g++ over Ubuntu
Typically install g++, try command:xiwang@xiwang:~$ sudo apt-get install build-essential原创 2012-12-16 18:19:19 · 681 阅读 · 0 评论 -
Trim a string with C++ [2]
I've wrote a blog to discuss how to trim a string in C++. Now I find an other way in high performance, see the implements below: #include #define STRING_TRIM_DROPS " \t"std::string& trim(st原创 2012-11-22 16:49:55 · 820 阅读 · 0 评论