Skip to content

Instantly share code, notes, and snippets.

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

bygreencn bygreencn

💭
I may be slow to respond.
View GitHub Profile
@bygreencn
bygreencn / export.c
Last active May 3, 2017 03:00
Export Def form DLL for MSVC
#include <windows.h>
#include <WinNT.h>
#include <stdio.h>
#include <stdlib.h>
#include <map>
#include <string>
#define PEEF_PRINT_ORDINALS 0x01
@bygreencn
bygreencn / 01-vilma-dependencies
Created April 19, 2017 10:03 — forked from cfpperche2/01-vilma-dependencies
Ubuntu 14.04 + Kernel 3.14.17 + Xenomai 2.6.4 + RTnet-master + ROS Indigo + Orocos 2.8
#!/usr/bin/env bash
# This is an installation tutorial of the OROCOS v2.8 with the ROS Indigo and
# the Xenomai 2.6.4 on Ubuntu 14.04.
# The following is adapted from:
# https://help.ubuntu.com/community/Kernel/Compile#Alternate_Build_Method:_The_Old-Fashioned_Debian_Way
# http://www.xenomai.org/documentation/xenomai-2.6/README.INSTALL
# Update kernel
sudo apt-get install linux-image-generic-lts-trusty

Testing qemu 2.1 arm64 support

qemu-system-aarch64 -m 1024 -cpu cortex-a57 -nographic -machine virt -kernel trusty-server-cloudimg-arm64-vmlinuz-generic -append 'root=/dev/vda1 rw rootwait mem=1024M console=ttyAMA0,38400n8 init=/usr/lib/cloud-init/uncloud-init ds=nocloud ubuntu-pass=ubuntu' -drive if=none,id=image,file=trusty-server-cloudimg-arm64-disk1.img -netdev user,id=user0 -device virtio-net-device,netdev=user0 -device virtio-blk-device,drive=image

qemu-system-aarch64 -m 1024 -cpu cortex-a57 -nographic -machine virt -kernel trusty-server-cloudimg-arm64-vmlinuz-generic -append 'root=/dev/vda1 rw rootwait mem=1024M console=ttyAMA0,38400n8 init=/usr/lib/cloud-init/uncloud-init ds=nocloud' -drive if=none,id=image,file=trusty-server-cloudimg-arm64-disk1.img -netdev user,id=user0 -device virtio-net-device,netdev=user0 -device virtio-blk-device,drive=image

[A Quick'n'Dirty Set-up of an Aarch64 Ubuntu 14.04 VM with QEMU]

@bygreencn
bygreencn / min-char-rnn.py
Created January 17, 2017 13:58 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@bygreencn
bygreencn / eggs_detector.cpp
Last active August 29, 2015 14:27 — forked from BloodAxe/eggs_detector.cpp
Image enchancement and Hough transform example
/**
* @brief Image enchancement and Hough transform example
* @author Eugene Khvedchenya <[email protected]>
* @copyright computer-vision-talks.com/articles/how-to-detect-circles-in-noisy-image/
*/
#include <opencv2/opencv.hpp>
// ==UserScript==
// @name ShadowX Profile
// @namespace com.gmail.open.xuyiming
// @version 0.1
// @description 在 ShadowX 的节点页面显示 JSON 格式的配置文件
// @author +依然独特
// @match *://shadowx.work/user/node/*
// @match *://shadowx.co/user/node/*
// @include *://shadowx.work/user/node/*
// @include *://shadowx.co/user/node/*
#include "thread_id_pool.h"
#include <pthread.h>
#include <assert.h>
static pthread_key_t s_tkey;
static pthread_once_t s_tkey_once;
static void freeKey(void *p)
{
ThreadIdPool::TVal *val = (ThreadIdPool::TVal*) p;
#!/bin/bash
###########################################################################
# Choose your ffmpeg version and your currently-installed iOS SDK version:
#
VERSION="2.0.2"
SDKVERSION="7.0"
ARCHS="armv7 armv7s i386"
#
#
@bygreencn
bygreencn / readme.txt
Last active August 29, 2015 14:13 — forked from fqrouter/readme.txt
good, 你已经有了一个自己的shadowsocks代理了,现在想要把这个代理公布出去给所有人分享。
但是没有两个小时,代理就没法使用了,为什么?因为你需要额外注意以下事项(以下步骤需要比较高的linux技能)
本文只关注于确保shadowsocks服务还“活着”,如果你希望让其跑得更快,请参考
https://github.com/clowwindy/shadowsocks/wiki/Optimizing-Shadowsocks
1、 shadowsocks的timeout设置
超时时间越长,连接被保持得也就越长,导致并发的tcp的连接数也就越多。对于公共代理,这个值应该调整得小一些。推荐60秒。
2、 检查操作系统的各种限制
对于openvz的vps,特别需要检查一下
$ vi /etc/sysctl.conf
# 系统所有进程一共可以打开的文件数量, 每个套接字也占用一个文件描述字
fs.file-max = 1491124
# 系统同时保持TIME_WAIT套接字的最大数目,http 短链接会产生很多 TIME_WAIT 套接字。
net.ipv4.tcp_max_tw_buckets = 7000
# 关闭 tcp 来源跟踪
net.ipv4.conf.default.accept_source_route = 0
# 缩短套接字处于 TIME_WAIT 的时间, 60s -> 30s
net.ipv4.tcp_fin_timeout = 30
# 启用 TIME_WAIT 复用,使得结束 TIEM_WAIT 状态的套接字的端口可以立刻被其他套接字使用。