Skip to content

Instantly share code, notes, and snippets.

View gitsrc's full-sized avatar
🦄
welcome

GITSRC gitsrc

🦄
welcome
View GitHub Profile
@gitsrc
gitsrc / runTime.c
Created July 5, 2018 06:41
C获取程序运行时间
#include <sys/time.h>
#include <stdio.h>
float timedifference_msec(struct timeval t0, struct timeval t1)
{
return (t1.tv_sec - t0.tv_sec) * 1000.0f + (t1.tv_usec - t0.tv_usec) / 1000.0f;
}
int main(void)
{
@gitsrc
gitsrc / php_compile.txt
Created July 12, 2018 06:04
php compile
--prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/conf.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --disable-fileinfo --enable-opcache --with-xsl
@gitsrc
gitsrc / configure1.txt
Created July 12, 2018 07:39
configure 时-g 与 -O0 开关控制
变为-O0 选项,可以导出CFLAGS 变量,如下进行。
export CFLAGS='-DGCC_HASCLASSVISIBILITY -O0 -Wall -W'
再重新配置,编译即可。
@gitsrc
gitsrc / c_string_hash.c
Created July 26, 2018 03:04
c_string_hash
unsigned int RSHash(char* str, unsigned int len)
{
unsigned int b = 378551;
unsigned int a = 63689;
unsigned int hash = 0;
unsigned int i = 0;
for(i = 0; i < len; str++, i++)
{
hash = hash * a + (*str);
a = a * b;
@gitsrc
gitsrc / posix-queue-epoll-server.c
Last active January 26, 2024 08:39
posix-queue-epoll-server
#include <stdio.h>
#include <mqueue.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h> //for close
#include <sys/epoll.h> // for epoll_create1(), epoll_ctl(), struct epoll_event
#define PATH_URI "/corermanipc"
@gitsrc
gitsrc / posix-queue-client.c
Created August 1, 2018 14:40
posix-queue-client
#include <stdio.h>
#include <mqueue.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#define PATH_URI "/corermanipc"
#define MAX_LEN 2000
@gitsrc
gitsrc / gist:01255ad88a60bba26a963f10135a9bf8
Created September 1, 2018 14:44
ubuntu 18.04下双击运行可执行shell脚本
1、安装 dconf-editor
sudo apt-get install dconf-editor
2、安装完成后直接输入dconf-editor打开dconf-editor
dconf-editor
3、org->gnome->natuilus->preferences->executable-text-activation
@gitsrc
gitsrc / chacha20x.go
Created September 24, 2018 01:26
chacha20x
package main
import (
"fmt"
"golang.org/x/crypto/chacha20poly1305"
"log"
)
func main() {
key := []byte("D403842636B7D8E66FE5FB4E7BE6973A")
@gitsrc
gitsrc / nginx_with_gogs
Created October 25, 2018 08:30
nginx with gogs
location / {
client_max_body_size 100m;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@gitsrc
gitsrc / 安装boost库.txt
Last active January 10, 2019 02:11
安装boost库
### Download Boost Library: http://www.boost.org (Choose the expected version)
```
wget https://cfhcable.dl.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.tar.gz
wget https://phoenixnap.dl.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.tar.gz
wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz
wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz
wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz
wget https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz
```