Skip to content

Instantly share code, notes, and snippets.

View legnaleurc's full-sized avatar

Wei-Cheng Pan legnaleurc

View GitHub Profile
@legnaleurc
legnaleurc / telnet_client.c
Last active December 4, 2024 10:12
Simple Telnet Client
/* http://l3net.wordpress.com/2012/12/09/a-simple-telnet-client/ */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <arpa/inet.h>
#include <termios.h>
#include <fcntl.h>
@legnaleurc
legnaleurc / etc_hosts
Last active January 26, 2022 12:54
Fix pod files for OpenSSL 1.0.1g
#192.168.1.100 ddld.loc.al
#127.0.0.1 ddld.loc.al
#127.0.0.1 www.gstatic.com
127.0.0.1 www.google-analytics.com
127.0.0.1 www.googletagmanager.com
#127.0.0.1 www.googleadservices.com
#127.0.0.1 ade.googlesyndication.com
#127.0.0.1 tpc.googlesyndication.com
#127.0.0.1 pagead2.googlesyndication.com
#127.0.0.1 securepubads.g.doubleclick.net
@legnaleurc
legnaleurc / arg.py
Created September 22, 2014 16:16
argparse bug
from __future__ import unicode_literals
from __future__ import print_function
import argparse
a = argparse.ArgumentParser()
b = a.add_subparsers(dest='command')
b.add_parser('test')
c = a.parse_args([])
print(c.command is None)
@legnaleurc
legnaleurc / wv.py
Created December 27, 2014 03:26
webview example
#! /usr/bin/env python3
import sys
from PySide import QtGui, QtWebKit
app = QtGui.QApplication(sys.argv)
@legnaleurc
legnaleurc / asyncio.py
Last active November 17, 2018 21:27
Tornado v.s. asyncio (Python 3.5+)
#! /usr/bin/env python3
import asyncio
import contextlib
async def ping(ip):
p = await asyncio.create_subprocess_exec('ping', '-c', '4', ip, stdout=asyncio.subprocess.PIPE)
async for line in p.stdout:
print(line)
@legnaleurc
legnaleurc / boost1.55_coroutine.patch
Last active August 29, 2015 14:23
boost1.55_coroutine.patch
Index: debian/changelog
===================================================================
--- debian/changelog (revision 14903)
+++ debian/changelog (working copy)
@@ -1,3 +1,9 @@
+boost1.55 (1.55.0+dfsg-4.1~coroutine1) experimental; urgency=low
+
+ * Enable coroutine shared library.
+
+ -- Wei-Cheng Pan <[email protected]> Fri, 26 Jun 2015 04:34:46 +0000
@legnaleurc
legnaleurc / devtools_client.py
Created February 3, 2016 09:19
devtools_client.py
#! /usr/bin/env python3
import asyncio
import json
import sys
import yaml
def main(args=None):
@legnaleurc
legnaleurc / stackstalker.cpp
Last active May 17, 2016 07:45
SpiderMonkey Stack Stalker
#include "mozilla/StackWalk.h"
#include "nsPrintfCString.h"
// HACK forward declartion
extern "C" char* PrintJSStack();
void JS_smprintf_free(char*);
#define DEBUG_STACK_PATH "/tmp/raw_stacks.txt"
namespace debug {
@legnaleurc
legnaleurc / transstack.py
Last active May 17, 2016 07:35
Translate C++ stack frame address to source address
#! /usr/bin/env python3
import re
import shutil
import sys
import asyncio
class BaseParser(object):
@legnaleurc
legnaleurc / build-llvm-clang.sh
Last active October 26, 2016 10:19
Build LLVM Clang toolchain
#! /bin/sh
set -e -x
BUILD_DIR='/tmp/llvm-clang'
INSTALL_DIR='~/local/opt/llvm-clang'
LLVM_VERSION='3.9.0'
DARWIN_VERSION='16.1.0'