Skip to content

Instantly share code, notes, and snippets.

@greensea
greensea / list_gcp_iprange.sh
Created Jun 17, 2019 — forked from n0531m/list_gcp_iprange.sh
Google Cloud Platform : ip address range
View list_gcp_iprange.sh
#!/bin/bash
# https://cloud.google.com/compute/docs/faq#find_ip_range
# nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8
myarray=()
for LINE in `dig txt _cloud-netblocks.googleusercontent.com +short | tr " " "\n" | grep include | cut -f 2 -d :`
do
myarray+=($LINE)
for LINE2 in `dig txt $LINE +short | tr " " "\n" | grep include | cut -f 2 -d :`
@greensea
greensea / BasicToken.sol
Created Aug 7, 2018
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
View BasicToken.sol
pragma solidity ^0.4.24;
import "./ERC20Basic.sol";
import "./SafeMath.sol";
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
@greensea
greensea / BasicToken.sol
Created Aug 2, 2018
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=true&gist=
View BasicToken.sol
pragma solidity ^0.4.24;
import "./ERC20Basic.sol";
import "./SafeMath.sol";
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
@greensea
greensea / BasicToken.sol
Created Aug 2, 2018
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=true&gist=
View BasicToken.sol
pragma solidity ^0.4.24;
import "./ERC20Basic.sol";
import "./SafeMath.sol";
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
@greensea
greensea / disk-quota-watcher.sh
Last active May 4, 2017
检查服务器指定分区的剩余空间,如果低于阈值则发送邮件通知
View disk-quota-watcher.sh
#/bin/sh
if [ $# -lt 4 ]
then
echo "Usage: $0 <mount_point> <min_space_MB> <to_email> <from_email>"
exit 0
fi
MOUNT_POINT=$1
MIN_SPACE_MB=$2
@greensea
greensea / context_switch_bench.c
Created Sep 22, 2015
比较 pthread_cond_wait 和 eventfd 的性能
View context_switch_bench.c
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/eventfd.h>
#include <sys/time.h>
int g_loops = 0;
int g_efd = 0;
int g_stop = 0;
@greensea
greensea / strcmp_bench.c
Created Sep 21, 2015
测试字符串比较函数的性能
View strcmp_bench.c
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <time.h>
#include "sds.h"
/**
* 高效地比较两个字符串的大小
*/
@greensea
greensea / OpenVPN-2.2.2-obfs.patch
Last active Jul 20, 2021
The obfs patch obsfucate OpenVPN traffic, make it looks like random traffic. The obfs patch add two options for OpenVPN. --obfs-salt <string> is a secret to generate the input XOR stream. To enable the obfs patch, this options must be set. --obfs-padlen <num> is a positive integer max to 255. This option tells obfs patch to padding random conten…
View OpenVPN-2.2.2-obfs.patch
--- openvpn-2.2.2.orig/options.c 2011-12-14 00:58:56.000000000 +0800
+++ openvpn-2.2.2/options.c 2012-12-21 10:44:57.683130505 +0800
@@ -54,6 +54,10 @@
#include "memdbg.h"
+extern char* _socket_obfs_salt;
+extern int _socket_obfs_salt_len;
+extern int _socket_obfs_padlen;
+