Skip to content

Instantly share code, notes, and snippets.

View tuanchauict's full-sized avatar
🐟
I am lazy

Tuan Chau tuanchauict

🐟
I am lazy
View GitHub Profile
elem = document.createElement("div");
elem.style.position="absolute";
elem.style.width="30px";
elem.style.height="30px";
elem.style.zIndex="9999999999";
elem.style.background="#f00";
elem.style.pointerEvents="none";
document.body.appendChild(elem);
document.onmousemove = function(e){
elem.style.left = e.x - 15;
adb shell << 'END'
run-as <package_id>
chmod 777 shared_prefs/<prefs_file_name>.xml
exit
cp /data/data/<package_id>/shared_prefs/<prefs_file_name>.xml /sdcard/Download/prefs.xml
exit
END
import scrapy
from crawler.items import CommentItem
from crawler.items import PostItem
class TinhteSpider(scrapy.Spider):
name = "tinhte"
allowed_domains = ["tinhte.vn"]
start_urls = [
@tuanchauict
tuanchauict / build.gradle
Last active October 14, 2016 04:07
Auto increment version code and version name. This gist borrows heavily the code from https://gist.github.com/luciofm/923a9f35f2175dda7ad7.
//module gradle
apply from: 'versionCode.gradle' //anywhere
android {
defaultConfig {
versionName VERSION_NAME
versionCode Integer.parseInt(VERSION_CODE)
}
}
@tuanchauict
tuanchauict / build.gradle
Last active November 29, 2022 10:07
Auto switch signing configs for multiple-releases-product
apply from: 'release.gradle'
android{
productFlavors {
dev {
//...
}
//...
}
@tuanchauict
tuanchauict / IDETextKeyBindingSet.plist
Last active November 9, 2016 03:37
XCode IDEA-like macro. Make XCode less suck
<key>Customized</key>
<dict>
<key>Duplicate Lines</key>
<string>selectLine:, copy:, moveToEndOfLine:, paste:, deleteBackward:</string>
<key>Duplicate Current Line</key>
<string>moveToBeginningOfLine:, deleteToEndOfLine:, yank:, insertNewline:, moveToBeginningOfLine:, yank:</string>
<key>Start New Line</key>
<string>moveToEndOfLine:, insertNewline:</string>
<key>Start New Line Above</key>
<string>moveUp:, moveToEndOfLine:, insertNewline:</string>
@tuanchauict
tuanchauict / README.md
Last active December 15, 2016 06:34
Build, install and run release build

Grab code then

apply from: 'lazy.gradle'

@tuanchauict
tuanchauict / README.md
Last active March 24, 2017 23:49
JConst: Automatically make constants

What is this?

Inspirated by Golang's const, I made this script for automation set value for constants white writing Java code.

Just:

//#constant(
int A;
int B;
android {
defaultConfig{
multiDexEnabled true
}
android.applicationVariants.all { variant ->
println "*********" + variant.description + "********** ";
def variants = variant.baseName.split("-");
def apkName = "mangarock-";
apkName += variants[0];
@tuanchauict
tuanchauict / script.js
Last active December 2, 2020 22:07
Make safaribooks great again
setTimeout(function() {
document.getElementsByClassName("sbo-toc-thumb")[0].click();
setInterval(function() {
document.getElementsByClassName("sbo-toc-thumb")[0].click();
}, 1000);
}, 2000);