Skip to content

Instantly share code, notes, and snippets.

View wen-long's full-sized avatar
☘️
wish to be lucky

wen-long

☘️
wish to be lucky
View GitHub Profile
@wen-long
wen-long / bash_interactive_and_login.sh
Created March 18, 2018 12:36 — forked from CMCDragonkai/bash_interactive_and_login.sh
Bash & ZSH: Interactive and Login Shells
#!/usr/bin/env bash
[[ $- == *i* ]] && echo "This Bash Shell is Interactive Shell" || echo "This Bash Shell is Not a Interactive Shell"
shopt -q login_shell && echo "This Bash Shell is a Login Shell" || echo "This Bash Shell is Not a Login Shell"
@wen-long
wen-long / sniproxy.md
Created January 8, 2018 16:31 — forked from pjamar/sniproxy.md
SNI Proxy Tutorial

SNI Proxy for sharing an SSL port 443 with Sandstorm

Make Sandstorm and other web server coexist in the same port while keeping HTTPS encryption.

Introduction

The purpose of this tutorial is to set up SNI Proxy so it’s possible to use Sandstorm verified SSL encryption while coexisting with another web server that also uses SSL.

The main reason is to allow other users to connect with your Sandstorm instance in the standard HTTPS port (443) and keep using that port also for any other web apps.

#include <stdio.h>
#ifdef _WIN32
/* MSVC, x86-only. Stupid compiler doesn't allow __asm on x86_64. */
bool cpuid(unsigned *_eax, unsigned *_ebx, unsigned *_ecx, unsigned *_edx)
{
#ifdef TARGET_CPU_X86
static bool cpuid_support = FALSE;
static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx)
{
/* ecx is often an input as well as an output. */
asm volatile("cpuid"
: "=a" (*eax),
"=b" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "0" (*eax), "2" (*ecx));
static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx)
{
/* ecx is often an input as well as an output. */
asm volatile("cpuid"
: "=a" (*eax),
"=b" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "0" (*eax), "2" (*ecx));
<!DOCTYPE html>
<!-- saved from url=(0038)https://cnlic.com/share/speedtest.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>VPS SPEEDTEST</title>
<link rel="stylesheet" href="./VPS SPEEDTEST_files/bootstrap.min.css">
<link rel="stylesheet" href="./VPS SPEEDTEST_files/bootstrap-theme.min.css">
<link rel="stylesheet" href="./VPS SPEEDTEST_files/custom.css">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>VPS SPEEDTEST</title>
<link rel="stylesheet" href="./VPS SPEEDTEST_files/bootstrap.min.css">
<link rel="stylesheet" href="./VPS SPEEDTEST_files/bootstrap-theme.min.css">

BandwagonHost 测速

@wen-long
wen-long / grab_apnic.js
Created December 4, 2016 10:47
结合公司用的 pac 使用,获取 apnic 的 geoip 的中国段
var request = require('sync-request');
function convertAddress(ipchars) {
var bytes = ipchars.split('.');
var result = (((bytes[0] & 0xff) << 24) |
((bytes[1] & 0xff) << 16) |
((bytes[2] & 0xff) << 8) |
(bytes[3] & 0xff)) >>> 0;
return result;
}