Skip to content

Instantly share code, notes, and snippets.

View kemadz's full-sized avatar

Kemad Zhong kemadz

View GitHub Profile
@kemadz
kemadz / vbox_arch_chroot.sh
Last active October 3, 2015 20:07
Chroot Part of ArchLinux Virtualbox Guest Install Script
#!/bin/sh
# Chroot Part of ArchLinux Virtualbox Guest Install Script
# timezone and hwclock
echo 'Asia/Shanghai' > /etc/timezone
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# hardware clock in local time
hwclock --systohc --localtime
# hostname
@kemadz
kemadz / vbox_arch.sh
Last active November 21, 2015 17:34
LiveISO Part of ArchLinux Virtualbox Guest Install Script
#!/bin/sh
# LiveISO Part of ArchLinux Virtualbox Guest Install Script
# system clock
# date `date +%m%d%H%M%Y.%S --date='-8 hour'`
ntpdate time.asia.apple.com
# partitions
sgdisk --zap-all /dev/sda
sgdisk \
@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;
}

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.
#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);
<?php
$cmd = 'date';
$desc = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'w')
);
$pwd = '~';
$env = array();
@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
@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 / 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 / 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}\""