Skip to content

Instantly share code, notes, and snippets.

@elleryq
elleryq / fig.yml
Created November 28, 2014 06:05
My fig.yml for gitlab-docker.
gitlab:
image: sameersbn/gitlab:7.5.1
ports:
- "10080:80"
- "10022:22"
environment:
- DB_USER=gitlab
- DB_PASS=your_password
- DB_NAME=gitlabhq_production
- DB_HOST=your_host_ip
@elleryq
elleryq / sendmail.py
Created December 4, 2014 09:18
MonkeyRunner script to send mail.
import sys
from com.android.monkeyrunner import MonkeyRunner
from com.android.monkeyrunner import MonkeyDevice
from com.android.monkeyrunner.easy import EasyMonkeyDevice,By
device=MonkeyRunner.waitForConnection(10)
if device:
print("Connect device successful!")
else:
print("Connect device failed!")
@elleryq
elleryq / ViewClientExample.py
Created December 4, 2014 09:36
MonkeyRunner and AndroidViewClient example. Detect whether the call is coming.
import sys
# put jar into sys.path
sys.path.append(os.path.join("your_path", "androidviewclient-2.3.25.jar"))
from com.dtmilano.android.viewclient import ViewClient
# if you connect multiple device, you can specify serialno
# you can get serialno via 'adb devices'
device, serialno = ViewClient.connectToDeviceOrExit(
@elleryq
elleryq / Main.java
Created December 21, 2014 22:04
Java JDBC with jtds example. 1. Open SQL Configuration Manager to make sure that TCP/IP is enabled and IP/All port is 1433. 2. Open 'Service' to make sure SQL server browser is started. 3. Open SQL Management Studio to make sure user has the permission to access.
// If you cannot connect with SQL server(express), you can check here: http://stackoverflow.com/questions/10522120/connecting-to-local-ms-sql-server
package com.example.jtdsexample;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Main {
public static void main(String[] args) {
@elleryq
elleryq / cnproxy.py
Last active August 29, 2015 14:12
Pick a server from top 10 proxy servers from http://cn-proxy.com.
"""
Dependencies:
* requests
* pyquery
ChangeLog:
* 2015/1/5 Check the length of returned proxy.
* 2014/12/27 Add seed() make sure randomize. Rename main to get_proxy_from_cnproxy for better using.
* 2014/12/27 Initial.
"""
from __future__ import print_function, unicode_literals
@elleryq
elleryq / add_tunnel_in_putty
Last active August 29, 2015 14:12
在 putty 裡輸入 tunnel,預設熱鍵是 Windows + P。cnproxy.py 在這裡 https://gist.github.com/elleryq/aff74c950863cad69faa#
; Execute command and read stdout.
CuteRun(c) {
full_command := comspec . " /c """ . c . """"
shell := comobjcreate("wscript.shell")
exec := (shell.exec(full_command))
stdout := exec.stdout.readall()
Return stdout
}
#P::
#!/usr/bin/env python3
# -*- coding: utf8 -*-
import sys, os
import sqlite3
import urllib.request
#import requests
import subprocess
from urwid import *
import pdb
@elleryq
elleryq / bubbleupnpserver.conf
Created December 31, 2014 03:18
BubbleUPnPServer configuration for supervisord. I suppose you put BubbleUPnPServer in /opt/BubbleUPnPServer
[program:bubbleupnpserver]
command=/opt/BubbleUPnPServer/launch.sh
directory=/opt/BubbleUPnPServer
autostart=true
user=your_user
@elleryq
elleryq / zxing.py
Created January 6, 2015 09:22
Modified from https://github.com/oostendo/python-zxing for crossing platform.
########################################################################
#
# zxing.py -- a quick and dirty wrapper for zxing for python
#
# this allows you to send images and get back data from the ZXing
# library: http://code.google.com/p/zxing/
#
# by default, it will expect to be run from the zxing source code directory
# otherwise you must specify the location as a parameter to the constructor
#
@elleryq
elleryq / 999-realmedia-support.patch
Created January 13, 2015 03:38
Add realmedia support in minidlna-1.1.4.
diff --git a/metadata.c b/metadata.c
index f3987c6..6012c06 100644
--- a/metadata.c
+++ b/metadata.c
@@ -841,6 +841,8 @@ GetVideoMetadata(const char *path, char *name)
xasprintf(&m.mime, "video/x-matroska");
else if( strcmp(ctx->iformat->name, "flv") == 0 )
xasprintf(&m.mime, "video/x-flv");
+ else if( strcmp(ctx->iformat->name, "rm") == 0 )
+ asprintf(&m.mime, "video/x-pn-realvideo");