Skip to content

Instantly share code, notes, and snippets.

View diewland's full-sized avatar
🧩
Jigsaw Fam

diewland.eth diewland

🧩
Jigsaw Fam
View GitHub Profile
@diewland
diewland / remove_game_services_s9plus.sh
Created December 11, 2019 15:26
Remove Samsung Game Services on S9+
# [1] list packages
#adb shell pm list packages -f | grep game | grep samsung
#
#package:/system/priv-app/GameHome/GameHome.apk=com.samsung.android.game.gamehome
#package:/system/priv-app/GameTools_Dream/GameTools_Dream.apk=com.samsung.android.game.gametools
#package:/system/app/GameOptimizingService/GameOptimizingService.apk=com.samsung.android.game.gos
# [2] get package path
#adb shell pm path com.samsung.android.game.gamehome
#adb shell pm path com.samsung.android.game.gametools
@diewland
diewland / ajax_json.js
Last active September 17, 2019 03:35
jQuery ajax json mode
function ajax_json(type, url, data, success_fn, failure_fn){
let ajax_options = {
type: type,
url: url,
dataType: 'json',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(data),
success: function(resp){
success_fn(resp);
},
@diewland
diewland / fix_width_print_wo_tab.py
Last active August 31, 2019 07:02
Print fix-width without tab
for i in range(10):
print('{:<10}: {}'.format('*'*(i+1), 'row %s' % (i+1)))
@diewland
diewland / inside_audio_segment_from_file_using_temporary_files.py
Created August 7, 2019 12:14
subprocess in pydub.AudioSegment.from_file_using_temporary_files
# https://github.com/jiaaro/pydub/blob/master/pydub/audio_segment.py
with open(os.devnull, 'rb') as devnull:
p = subprocess.Popen(conversion_command, stdin=devnull, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p_out, p_err = p.communicate()
@diewland
diewland / inside_audio_segment_from_file.py
Last active August 7, 2019 12:34
subprocess in pydub.AudioSegment.from_file
# https://github.com/jiaaro/pydub/blob/master/pydub/audio_segment.py
if filename:
conversion_command += ["-i", filename]
stdin_parameter = None # <------------------------------------------- Look at this line !!
stdin_data = None
else:
if cls.converter == 'ffmpeg':
conversion_command += ["-read_ahead_limit", str(read_ahead_limit),
"-i", "cache:pipe:0"]
# On Windows, running this from the binary produced by Pyinstaller
# with the ``--noconsole`` option requires redirecting everything
# (stdin, stdout, stderr) to avoid an OSError exception
# "[Error 6] the handle is invalid."
ret.update({'stdin': subprocess.PIPE,
'stderr': subprocess.PIPE,
'startupinfo': si,
'env': env })
return ret
import re
def validate_thai_filename(filename):
return re.sub('[^ก-๙a-zA-Z0-9.,_-]', '_', filename)
@diewland
diewland / onblur-next-target.js
Last active June 25, 2019 11:23
Find onblur next target
/* https://stackoverflow.com/a/11544685/466693 */
// focus on first element
$('.my-text').eq(0).focus();
// onblur event
$('.my-text').blur(function (event) {
// do onblur stuff
// ...
@diewland
diewland / profiles.json
Last active June 14, 2019 09:31
The new terminal profiles
{
"globals" :
{
"alwaysShowTabs" : true,
"defaultProfile" : "{09dc5eef-6840-4050-ae69-21e55e6a2e62}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
{
@diewland
diewland / .gitconfig
Last active May 29, 2019 10:59
Change editor in git
...
br = branch
co = checkout
[core]
autocrlf = input
editor = gvim <---- change editor command
[color]
diff = auto
status = auto
branch = auto