Skip to content

Instantly share code, notes, and snippets.

@aont
aont / detect_wakeup.rb
Created February 5, 2015 08:27
Android detect wakeup
#!/usr/bin/ruby
last_wake_time=0
while true
IO.popen("adb shell dumpsys power") do |p|
while line = p.gets
@aont
aont / xrandr.sh
Created August 2, 2015 01:30
xrandr panning
#!/bin/sh
xrandr --output LVDS1 --scale 1.3x1.3 --panning 1331x780 --fb 1331x780
@aont
aont / check_wake.rb
Created August 23, 2015 06:17
Check WOL and caffeinate
#!/usr/bin/ruby
# coding: utf-8
filepath="/var/log/system.log"
fpointer = 0
f = open(filepath)
f.seek(0, IO::SEEK_END)
fpointer = f.pos
while true
@aont
aont / regoogle.js
Last active July 13, 2023 07:20
ReGoogle
(function () {
var url = new URL(location);
var searchParams = url.searchParams;
var q = searchParams.get("q");
var promptResult = prompt("regoogle", q);
if(promptResult&&promptResult!=q) {
searchParams.set("q", promptResult);
url.search = searchParams.toString();
location.href = url.href;
}
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from HTMLParser import HTMLParser, HTMLParseError
preface='''<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
@aont
aont / kexec.sh
Created April 29, 2016 13:19
kexec ubuntu usb
#!/bin/sh
kexec -l /mnt/casper/vmlinuz.efi --command-line "noprompt cdrom-detect/try-usb=true file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz --" --initrd=/mnt/casper/initrd.lz
@aont
aont / scroll.el
Last active May 7, 2016 13:14
optimize scrolling on emacs
(setq scruptime 0)
(global-set-key [mouse-4]
'(lambda ()
(interactive)
(setq scruptime_new (float-time) )
(setq scrup_dt (- scruptime_new scruptime))
(if (> scrup_dt 0.05)
(scroll-down-line 1)
(scroll-down-line (ceiling (/ 0.05 scrup_dt) ) )
)
@aont
aont / ctrl-w.el
Last active May 15, 2016 14:22
kill-region only when any region is selected
(global-set-key
"\C-w"
(lambda ()
(interactive)
(if (region-active-p)
(kill-region (region-beginning) (region-end) )
(message "Please set region")
)
)
@aont
aont / bto_advanced_USBIR_cmd.diff.c
Created January 30, 2017 14:07
modify bto_advanced_USBIR_cmd to read data
/* before getopt_long */
FILE* D_fp = NULL;
int D_value;
int D_ret;
/* add D: to getopt_lonf */
getopt_long(argc, argv, "f:t:c:C:d:D:rsgh", options, &option_index)
/* add case for 'D' */
case 'D':
@aont
aont / disabled_apps.csv
Last active February 18, 2021 08:18
Android disabled apps
package name app name
com.sonymobile.entrance what's new
jp.co.nttdocomo.lcsappsub docomo位置情報
jp.co.nttdocomo.lcsapp docomo位置情報
com.nttdocomo.android.iconcier
com.nttdocomo.android.iconcier_contents
com.android.contacts
com.android.dialer
com.nttdocomo.android.applicationmanager docomo Application Manager
com.nttdocomo.android.socialphonebook