This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding=utf8 | |
#[email protected] | |
import random | |
import math | |
class Block(object): | |
def __init__(self, width, height): | |
self.width = width | |
self.height = height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int align = 8; | |
size_t round_up(size_t bytes) | |
{ | |
return ((bytes) + align - 1) & ~(align - 1) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
events { | |
use epoll; | |
} | |
http { | |
default_type text/html; | |
server { | |
listen 80; | |
server_name localhost; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ngx_config.h> | |
#include <ngx_core.h> | |
#include <ngx_http.h> | |
typedef struct { | |
ngx_str_t output_words; | |
} ngx_http_hello_world_loc_conf_t; | |
// To process HelloWorld command arguments | |
static char* ngx_http_hello_world(ngx_conf_t* cf, ngx_command_t* cmd, void* conf); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require "ffi" | |
local sha512 = require "resty.sha512" | |
local aes = require "resty.aes" | |
local ffi_new = ffi.new | |
local ffi_str = ffi.string | |
local C = ffi.C | |
local setmetatable = setmetatable | |
local error = error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "rsa.h" | |
#include <stdio.h> | |
#include <conio.h> | |
#include <windows.h> | |
#include <wincrypt.h> | |
#include "base64.h" | |
#pragma comment(lib, "crypt32.lib") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <pthread.h> | |
void initArray(int* array, int N) | |
{ | |
int i = 0; | |
for(i = 0; i < N; i++) | |
{ | |
array[i] = (int)random(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import chardet | |
BOM_UTF8 = '\xef\xbb\xbf' | |
def detect(raw): | |
if raw.startswith(BOM_UTF8): | |
return 'utf-8-sig' | |
else: | |
result = chardet.detect(raw) | |
return result['encoding'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set smartindent | |
set tabstop=4 | |
set shiftwidth=4 | |
"set expandtab | |
set softtabstop=4 | |
syntax on | |
filetype plugin on | |
autocmd FileType * set expandtab | |
autocmd FileType make set noexpandtab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Escape(sql string) string { | |
dest := make([]byte, 0, 2*len(sql)) | |
var escape byte | |
for i := 0; i < len(sql); i++ { | |
c := sql[i] | |
escape = 0 | |
switch c { | |
case 0: /* Must be escaped for 'mysql' */ |
OlderNewer