Skip to content

Instantly share code, notes, and snippets.

View kemadz's full-sized avatar

Kemad Zhong kemadz

View GitHub Profile
@kemadz
kemadz / install_archlinux_from_existing_linux.sh
Created December 24, 2014 01:48
Install from Existing Linux
#!/bin/sh
#
ARCH=x86_64
ARCH_TMP=/tmp/archlinux
ARCH_ROOT=/mnt/archlinux
mkdir $ARCH_TMP
cd $ARCH_TMP
@kemadz
kemadz / rename_photo_with_exif_info.py
Last active August 29, 2015 13:56
rename photo to yyyy-mm-dd_hh.mm.ss.jpg with exif info
import os, exifread
from time import strftime, strptime
for x in os.listdir('.'):
print x
tags = exifread.process_file(open(x), details=False)
try:
#t = tags['EXIF DateTimeOriginal'].values
t = tags['Image DateTime'].values
print t
t = strptime(t, '%Y:%m:%d %H:%M:%S')
@kemadz
kemadz / make.conf
Created January 11, 2014 08:58
make.conf of Gentoo
ACCEPT_KEYWORDS="~amd64"
FEATURES="ccache mini-manifest parallel-fetch"
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe"
MAKEOPTS="-j3"
GENTOO_MIRRORS="http://mirrors.sohu.com/gentoo"
# GENTOO_MIRRORS="http://mirrors.163.com/gentoo"
# FETCHCOMMAND="/usr/bin/axel -a -n5 \"\${URI}\" -o \"\${DISTDIR}/\${FILE}\""
@kemadz
kemadz / vbox_fnto_chroot.sh
Last active December 28, 2015 20:39
Funtoo Install Script Chroot Part for Virtualbox
#!/bin/sh
# Funtoo Install Script Chroot Part for Virtualbox
# 更新环境变量
source /etc/profile
export PS1="(chroot) $PS1"
# 设置时区和硬件时钟
echo "-*- locale -*-"
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
@kemadz
kemadz / vbox_fnto.sh
Last active December 28, 2015 20:39
Funtoo Install Script Chroot Part for Virtualbox
#!/bin/sh
# Funtoo Install Script Chroot Part for Virtualbox
# 校准系统, UTC标准时间
echo "-*- Adjusting the time -*-"
ntpdate time1.google.com
# 创建分区
echo "-*- Partitioning the disk -*-"
sgdisk \
@kemadz
kemadz / ebk2sel.py
Last active January 15, 2020 06:05
通达信,同花顺板块导出文件转换
#!/usr/bin/python
# -*- coding: utf-8 -*-
import struct
'''
同花顺自选股文件格式:
0000000: 0900 0721 3030 3039 3731 0711 3630 3036 ...!000971..6006
0000010: 3738 0721 3030 3231 3134 0721 3030 3232 78.!002114.!0022
<?php
$cmd = 'date';
$desc = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'w')
);
$pwd = '~';
$env = array();
#include <stdio.h>
float InvSqrt(float x)
{
float xhalf = 0.5f * x;
int i = *(int*)&x;
i = 0x5f375a86 - (i>>1);
printf("%d", i);
x = *(float*)&i;
printf("%f", x);

RHEL Express

Introduction

  • RHEL(Red Hat Enterprise Linux)
    • Most popular Enterprise Linux distribution.
    • The de facto standard.
    • It's open source.
    • But software updates are available only through a paid subscription service.
  • CentOS(Community ENTerprise Operating System) RECOMMENDED
  • Building from the source of RHEL.
@kemadz
kemadz / nginx.conf
Created September 1, 2012 11:41
Nginx Configuration
#user http http;
worker_processes 1;
worker_rlimit_nofile 64000;
error_log /var/log/nginx/error.log info;
events {
worker_connections 16000;
use epoll;
}