Skip to content

Instantly share code, notes, and snippets.

View ixqbar's full-sized avatar
💭
I may be slow to respond.

Well ixqbar

💭
I may be slow to respond.
View GitHub Profile
@ixqbar
ixqbar / rc4.md
Created October 19, 2016 06:54
php-rc4
function rc4($data, $pwd = 'xingqiba') {
		$key[] ="";
		$box[] ="";
		$cipher = "";

		$pwd_length = strlen($pwd);
		$data_length = strlen($data);
@ixqbar
ixqbar / go_learn.md
Created October 17, 2016 07:18
golang-action
//整形转换成字节
func IntToBytes(n int) []byte {
    x := int32(n)
 
    bytesBuffer := bytes.NewBuffer([]byte{})
    binary.Write(bytesBuffer, binary.BigEndian, x)
    return bytesBuffer.Bytes()
}
 
@ixqbar
ixqbar / go_echo_server.md
Created October 13, 2016 08:21
echo_server
package main

import (
	"flag"
	"fmt"
	"io"
	"net"
@ixqbar
ixqbar / php-extension-yilai.md
Created September 13, 2016 08:19
php-extension依赖

###example

PHP_ADD_EXTENSION_DEP(extension_name, json, true)
@ixqbar
ixqbar / curltest.c
Created May 27, 2016 03:44 — forked from aaronhurt/curltest.c
example code using libcurl and json-c to post and parse a return from http://jsonplaceholder.typicode.com
/**
* example C code using libcurl and json-c
* to post and return a payload using
* http://jsonplaceholder.typicode.com
*
* Requirements:
*
* json-c - https://github.com/json-c/json-c
* libcurl - http://curl.haxx.se/libcurl/c
*
@ixqbar
ixqbar / gps.md
Created March 22, 2016 09:46
位置坐标转换
<?php

class EvilTransform {

	const XPI = 3.14159265358979324 * 3000.0 / 180.0;

	/**
	 * outOfChina
@ixqbar
ixqbar / crontab_lock.md
Created February 26, 2016 02:01
crontab冲突解决方法

#solo

#!/usr/bin/perl -s
#
# solo v1.6
# Prevents multiple cron instances from running simultaneously.
#
# Copyright 2007-2013 Timothy Kay
@ixqbar
ixqbar / rand.md
Created January 18, 2016 01:18
rand
int randInRange(int min, int max) 
{
  return (int)(((double) rand() / (double)(RAND_MAX + 1)) * (max - min + 1)) + min;
}
@ixqbar
ixqbar / swoole-yar.md
Created January 13, 2016 07:35
使用swoole实现yar服务端功能
<?php


class G
{
    static $server_handle;
    static $config = array(
        'daemonize' => false,
@ixqbar
ixqbar / game_drops.md
Last active January 12, 2016 03:01
游戏掉落概率
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>

//./a.out | grep select | awk -F " " '{print $2}' | sort | uniq -c

//https://zh.wikipedia.org/wiki/%E6%AD%A3%E6%80%81%E5%88%86%E5%B8%83