Skip to content

Instantly share code, notes, and snippets.

@junf
junf / write.py
Created Jun 3, 2018
mode の検証4
View write.py
with open('abc.txt', mode) as f:
f.write('abc')
@junf
junf / read.py
Created Jun 3, 2018
mode の検証3
View read.py
with open('abc.txt', mode) as f:
print(f.read())
@junf
junf / tell.py
Created Jun 3, 2018
mode の検証2
View tell.py
with open('abc.txt', mode) as f:
print(f.tell())
@junf
junf / open.py
Created Jun 3, 2018
mode の検証1
View open.py
open('abc.txt', mode)
@junf
junf / env.bat
Last active Dec 31, 2015
bat for compiling with Qt + Mingw
View env.bat
@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 Dec 29, 2015
bat for Building Qt5 on MinGW64
View qt5build.bat
@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 があるディレクトリ
View gist:7288407
#!/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
PySide: hide/show mouse cursor
View gist:5599293
# Hide mouse cursor
widget.setCursor(Qt.BlankCursor)
# Show mouse cursor (parent's cursor is used)
widget.unsetCursor()
@junf
junf / gist:5074821
Last active Dec 14, 2015
Reset preferences back to their default values of Android.
View gist:5074821
PreferenceManager
.getDefaultSharedPreferences(ctx)
.edit()
.clear()
.commit();
PreferenceManager.setDefaultValues(ctx, R.xml.preferences, true);
@junf
junf / gist:5074217
Last active Jun 14, 2018
Restart Activity with no animation on Android.
View gist:5074217
private void restartThis() {
finish();
overridePendingTransition(0, 0);
startActivity(getIntent());
overridePendingTransition(0, 0);
}