Skip to content

Instantly share code, notes, and snippets.

View Cysu's full-sized avatar

Tong Xiao Cysu

View GitHub Profile
@Cysu
Cysu / gist:7461066
Last active September 20, 2022 18:48
Python: PyQt- FlowLayout
#! /usr/bin/python2
# -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui
class FlowLayout(QtGui.QLayout):
def __init__(self, parent=None, margin=0, spacing=-1):
super(FlowLayout, self).__init__(parent)
if parent is not None:
@Cysu
Cysu / gist:7463103
Created November 14, 2013 08:00
Python: Network Registration for ERGWAVE Wi-Fi
import urllib
import urllib2
import socket
import uuid
macaddr = ':'.join(['{:02x}'.format((uuid.getnode() >> i) & 0xff) for i in range(0,8*6,8)][::-1])
ipaddr = socket.gethostbyname(socket.getfqdn())
url = 'https://securelogin.arubanetworks.com/cgi-bin/login?cmd=login&mac={0}&ip={1}&essid=%20'.format(macaddr, ipaddr)
@Cysu
Cysu / gist:7596046
Created November 22, 2013 07:11
Python: PyQt- Move widget to center
fg = self.frameGeometry()
cp = QtGui.QDesktopWidget().availableGeometry().center()
fg.moveCenter(cp)
self.move(fg.topLeft())
@Cysu
Cysu / resnet50_trainval.prototxt
Created August 8, 2016 02:50
Pre-ResNet Caffe prototxt
name: "ResNet_50"
layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
@Cysu
Cysu / Matplotlib.ipynb
Created January 20, 2017 02:06
[ELEG5491] Python Tutorial
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Cysu
Cysu / SimpleCNN.ipynb
Last active February 24, 2017 08:44
PyTorch Tutorial
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.