Skip to content

Instantly share code, notes, and snippets.

@junf
junf / write.py
Created June 3, 2018 03:35
mode の検証4
with open('abc.txt', mode) as f:
f.write('abc')
@junf
junf / read.py
Created June 3, 2018 03:30
mode の検証3
with open('abc.txt', mode) as f:
print(f.read())
@junf
junf / tell.py
Created June 3, 2018 03:24
mode の検証2
with open('abc.txt', mode) as f:
print(f.tell())
@junf
junf / open.py
Created June 3, 2018 03:18
mode の検証1
open('abc.txt', mode)
@junf
junf / env.bat
Last active December 31, 2015 19:49
bat for compiling with Qt + Mingw
@REM Qt5 + MinGW でコンパイルできる環境を作るバッチ
@REM === ENV ===
SET MINGWBIN=c:\mingw64\bin
SET PERLBIN=C:\strawberry\perl\bin
SET PYTHONBIN=c:\python27
SET RUBYBIN=C:\Ruby200-x64\bin
SET GITBIN=C:\mingw64\msys\bin
SET QTREPO=C:\Qt\qt5
@junf
junf / qt5build.bat
Last active December 29, 2015 20:59
bat for Building Qt5 on MinGW64
@REM MinGW64 で Qt5 をコンパイルするためのバッチ
@REM 参考) MinGW 64 bit | Qt Wiki | Qt Project http://qt-project.org/wiki/MinGW-64-bit
@REM
@REM [使い方]
@REM あらかじめ、OpenSSL, ICU をビルドし、インストールしておく事
@REM 以下の環境変数の値を === ENV === の欄で適切に設定する
@REM MINGWBIN MinGW の bin ディレクトリ (コンパイラがあるディレクトリ)
@REM PERLBIN perl.exe があるディレクトリ
@REM PYTHONBIN python.exe があるディレクトリ
@REM RUBYBIN ruby.exe があるディレクトリ
#!/bin/bash
#
# Brightness script for the ASUS G74SX
#
# Arguments:
# up - increase brightness by 1
# down - decrease brightness by 1
#
BRIGHTNESS=`cat /sys/devices/platform/asus-nb-wmi/leds/asus\:\:kbd_backlight/brightness`
@junf
junf / gist:5599293
Created May 17, 2013 14:13
PySide: hide/show mouse cursor
# Hide mouse cursor
widget.setCursor(Qt.BlankCursor)
# Show mouse cursor (parent's cursor is used)
widget.unsetCursor()
@junf
junf / gist:5074821
Last active December 14, 2015 10:48
Reset preferences back to their default values of Android.
PreferenceManager
.getDefaultSharedPreferences(ctx)
.edit()
.clear()
.commit();
PreferenceManager.setDefaultValues(ctx, R.xml.preferences, true);
@junf
junf / gist:5074217
Last active June 5, 2023 10:00
Restart Activity with no animation on Android.
private void restartThis() {
finish();
overridePendingTransition(0, 0);
startActivity(getIntent());
overridePendingTransition(0, 0);
}