Skip to content

Instantly share code, notes, and snippets.

View KengoSawa2's full-sized avatar
💭
Proud person and beautiful flowers know when their lives are to be over.

Kengo Sawatsu KengoSawa2

💭
Proud person and beautiful flowers know when their lives are to be over.
View GitHub Profile
@Atsushi4
Atsushi4 / tablewidget_int_sort.moc
Created September 13, 2012 14:20
QtのItemViewの規定動作確認。setしたデータの型によってsortの挙動やDelegateが変わる。
#include <QTableWidget>
#include <QDateTime>
#include <QApplication>
static void init(QTableWidget &w) {
w.setSortingEnabled(true);
w.setRowCount(10);
w.setColumnCount(10);
w.resize(640, 480);
@nobonobo
nobonobo / Py2AppTips.rst
Last active June 21, 2016 02:54
メモ:py2appのコツ

Py2AppのTips

  • 直接import記述していないパッケージが取り込まれない場合がある。
  • 動作するときのsys.modulesと動作しない時のsys.modulesをよく見比べましょう。
  • pngだろうがなんだろうが、「tiff2icns」でicnsファイルは作れる。
  • OS-X内蔵Pythonはアプリ内に複製できない(py2appの仕様)ので、別途Pythonをインストールする必要がある。 (portsサンプル多いが、brewでもできたー。)

for PyQt or PySide

@mkropat
mkropat / knownpaths.py
Last active February 4, 2025 17:31
Python wrapper around the SHGetKnownFolderPath Windows Shell function
import ctypes, sys
from ctypes import windll, wintypes
from uuid import UUID
class GUID(ctypes.Structure): # [1]
_fields_ = [
("Data1", wintypes.DWORD),
("Data2", wintypes.WORD),
("Data3", wintypes.WORD),
("Data4", wintypes.BYTE * 8)
@t-nissie
t-nissie / delxattr.py
Last active June 6, 2016 02:37
Mac OS Xとかでファイルとディレクトリの拡張属性xattrを再帰的にすべて消す高速なPythonスクリプトdelxattr.py
#!/usr/bin/env python
# delxattr.py recursively removes all extended attributes (xattr) from
# all files and directories under the current or given directory.
# In the latest Mac OS X, you can do the same thing with "xattr -rc".
# See a help of xattr with "xattr -h".
# Author: Takeshi NISHIMATSU
# Gist: https://gist.github.com/t-nissie/8491009
# Example1$ delxattr.py
# Example2$ delxattr.py ../foo
# Example3$ delxattr.py ~/foo
@voluntas
voluntas / webrtc_conf_ja.rst
Last active September 20, 2017 03:08
WebRTC Conference Japan で話してきた
@voluntas
voluntas / webrtc.rst
Last active March 28, 2025 06:01
WebRTC コトハジメ
"""
A simple example pyside app that demonstrates dragging and dropping
of files onto a GUI.
- This app allows dragging and dropping of an image file
that this then displayed in the GUI
- Alternatively an image can be loaded using the button
- This app includes a workaround for using pyside for dragging and dropping
@pdarragh
pdarragh / get_serial.py
Last active December 3, 2024 08:57
Short PyObjC script to get a Mac's serial number without calling `system_profiler`.
#!/usr/bin/python
# (Note that we must use system Python on a Mac.)
####
# Quick script to get the computer's serial number.
#
# Written for @john.e.lamb on the MacAdmins Slack team.
import objc
import CoreFoundation
@pudquick
pudquick / statfs.py
Last active August 27, 2020 05:10
Calling statfs from python on OS X via ctypes for inspecting filesystem information
from ctypes import CDLL, Structure, c_uint32, c_int64, c_uint64, c_char, create_string_buffer, byref, c_ubyte, c_int16, c_int64, c_int32
# when _DARWIN_FEATURE_64_BIT_INODE is not defined
class statfs32(Structure):
_fields_ = [
("f_otype", c_int16),
("f_oflags", c_int16),
("f_bsize", c_int64),
("f_iosize", c_int64),
("f_blocks", c_int64),
#!/bin/bash
export LANG=C
for ((i=0;1;i++)) ; do
if make -j16 >/dev/null 2>>log.txt ; then
echo "$i: $(date): OK" >>log.txt
else
echo "$i: $(date): NG" >>log.txt
fi