Skip to content

Instantly share code, notes, and snippets.

View gyu-don's full-sized avatar

Takumi Kato gyu-don

  • Japan
View GitHub Profile
@gyu-don
gyu-don / pyqt4_example.py
Created April 17, 2016 13:49
PyQt4 stackoverflow
import sys
from PyQt4 import QtGui, QtCore
#http://stackoverflow.com/questions/36675609/how-can-i-create-multi-page-applications-in-pyqt4/36676917
class Window(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
widget1 = QtGui.QLabel("Page 1")
@gyu-don
gyu-don / pyqt4_dockwidget_example
Created April 17, 2016 14:18
PyQt4 stackoverflow
import sys
from PyQt4 import QtGui, QtCore
class Window(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
widget1 = QtGui.QDockWidget("Page 1")
widget1.setWidget(QtGui.QLabel("Page 1"))
widget2 = QtGui.QDockWidget("Page 2")
@gyu-don
gyu-don / pyqt4_example_3rd.py
Created April 17, 2016 14:41
PyQt4 stackoverflow
import sys
from PyQt4 import QtGui, QtCore
class Window(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
widget = QtGui.QWidget()
widget1 = QtGui.QLabel("Page 1", widget)
widget2 = QtGui.QLabel("Page 2", widget)
@gyu-don
gyu-don / wp_hops.py
Created June 25, 2016 14:03
wp_hops Part-1
import sys
import getpass
import mysql.connector
class WordNotFoundError(Exception):
def __init__(self, word):
self.word = word
def __str__(self):
return self.word + " was not found."
@gyu-don
gyu-don / wp_hops.py
Created June 26, 2016 05:11
wp_hops Part-2
import sys
import getpass
import mysql.connector
class WordNotFoundError(Exception):
def __init__(self, word):
self.word = word
def __str__(self):
return self.word + " was not found."
@gyu-don
gyu-don / dotdict.py
Last active July 6, 2016 13:33
tips for python
class dotdict(dict):
__getattr__ = dict.__getitem__
__setattr__ = dict.__setitem__
"""descriptions:
Like a JavaScript, get dictionary item via attribute.
d = dotdict()
d.a = 1
print(d.a) # ==> 1
@gyu-don
gyu-don / fizzbuzz_oneline.py
Last active March 23, 2023 20:23
maybe, shortest fizzbuzz of python3
for i in range(100):print(i%3//2*"Fizz"+i%5//4*"Buzz"or-~i)
@gyu-don
gyu-don / dolphin_gesture.khotkeys
Created October 26, 2016 16:37
KDE Dolphin mousegesture
[Data]
DataCount=1
[Data_1]
Comment=Dolphin の基本的なジェスチャーです。(マウスジェスチャーに使用するボタンは「全体設定」で変更できます)
DataCount=12
Enabled=true
Name=Dolphin ジェスチャー
SystemGroup=0
Type=ACTION_DATA_GROUP
@gyu-don
gyu-don / config
Created March 11, 2017 07:35
i3 config file
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@gyu-don
gyu-don / print_var.rs
Created August 15, 2017 22:59
Rust macro for print variable (or value)
macro_rules! print_var_fmt {
($e:expr) => {
concat!(stringify!($e), ":\t{}")
};
($e:expr, $($es: expr),+) => {
concat!(print_var_fmt!($e), ",\t", print_var_fmt!($($es),+))
};
}
macro_rules! print_var {