Skip to content

Instantly share code, notes, and snippets.

View flyfire's full-sized avatar
🎯
Focusing

flyfire flyfire

🎯
Focusing
View GitHub Profile
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
CREATE DATABASE wordpress;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
ON wordpress.*
TO site@localhost
IDENTIFIED BY 'sitepwd';
FLUSH PRIVILEGES;
#include "solarex.h"
#include <error.h>
#include <stdarg.h>
static void err_doit(int, int, const char *, va_list);
/* nonfatal error related to system call.
* print a message and return
*/
void err_ret(const char *fmt, ...)
/* error routines for programs that can run as a daemon */
#include "solarex.h"
#include <errno.h>
#include <stdarg.h>
#include <syslog.h>
static void log_doit(int, int, const char *fmt, va_list ap);
/* caller must define and set this: nonzero if interactive, zero if daemon */
extern int log_to_stderr;
#ifndef _SOLAREX_H
#define _SOLAREX_H
#define _XOPEN_SOURCE 600 /* Signle UNIX Specification, Version 3 */
/* header files */
#include <sys/types.h> /* some systems still require this */
#include <sys/stat.h>
#include <sys/termios.h>
#ifndef TIOCGWINSZ
*** Report for internal hard disk ***
Current GPT partition table:
# Start LBA End LBA Type
1 40 409639 EFI System (FAT)
2 409640 312519583 Mac OS X HFS+
3 312519584 313789119 Mac OS X Boot
4 313790464 317693951 Basic Data
5 317695376 321601625 Basic Data
[Desktop Entry]
Version=1.0
Name=Eclipse
Comment=Solarex's Eclipse
Exec=/home/hrh/Software/DevTools/adt-bundle-linux-x86_64-20131030/eclipse/eclipse -vm "/opt/jvm/jdk6u45/jdk1.6.0_45/bin/"
Terminal=false
Type=Application
StartupNotify=true
Icon=/home/hrh/Software/DevTools/adt-bundle-linux-x86_64-20131030/eclipse/icon.xpm
#!/bin/bash
#引用公用shell函数
funcs=`which functions.sh`
echo "funcs=$funcs"
. $funcs
#不搜索二进制文件,全字匹配,显示行号,不搜索~的临时文件
export GREP_OPTIONS='-R --exclude-dir=.svn --exclude-dir=.git --exclude=*~ --binary-files=without-match --color=always -n -H '
export GREP_COLOR='1;31'
src_str=$2
#!/bin/bash
functions_base_included=true
#>>>>>>>>>>文本颜色显示相关
#>>>>>>>>>>linux系统相关
#>>>>>>>>>>字符串处理相关
#function sh_sed_file_d_row_include_xxx() 删除包含特定内容的行
#function sh_sed_file_r_row_include_xxx() 替换包含特定内容的行
#function sh_sed_file_a_row_above_xxx() 在特定内容行上添加内容
#function sh_sed_file_a_row_below_xxx() 在特定内容行下添加内容
#!/bin/bash
#功能函数
funcs=`which functions.sh`
if [ "$funcs" != "" ] ;then
. $funcs
else
funcs=`dirname $0`/functions.sh
echo "$PWD"
echo "funcs=$funcs"
if [ "$funcs" != "" ] ;then