Skip to content

Instantly share code, notes, and snippets.

@dacer
dacer / Amazon-Personal-Documents-Deleter.js
Last active December 24, 2015 11:19
It's a veryvery simple js for deleting various documents you send to kindle by email. Just open the https://www.amazon.com/gp/digital/fiona/manage#All And open chrome console, copy/paste the js code in it then click your enter key. It will auto delete the 15 items on the page.
for (var i=1;i<16;i++){
document.getElementById("actionSelect"+i).click();
document.getElementById("deleteLink_"+i).click();
document.getElementsByClassName("ap_custom_close")[0].click();
}
#!/bin/bash
f=$(pwd)
mkdir drawable-mdpi drawable-hdpi drawable-xhdpi drawable-xxhdpi
# fake argv and argc in bash
argc=$#; argv[0]=$0 # argv[0] is a prog name
for foo in $( seq $argc )
do
def json2simpleHash(json_str, prefix = '')
result = {}
json = JSON.parse(json_str)
json.each do |key, value|
if(value.is_a?(Hash))
result.merge!(json2simpleHash(value.to_json, prefix+key+'_'))
else
result.merge!({"#{prefix}#{key}" => value})
end
end
@dacer
dacer / surge_main.conf
Created October 27, 2015 03:06 — forked from jason5ng32/surge.conf
Surge Configs ( Both 2 files are needed )
[General]
loglevel = notify
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24,100.64.0.0/10
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24,100.64.0.0/10
// DNS OVERRIDE, REMOVE # IF YOU NEED
# dns-server = 223.6.6.6,223.5.5.5,114.114.114.114,114.114.115.115
[Rule]
@dacer
dacer / ISO-3166.rb
Last active March 3, 2017 06:45
Convert ISO-3166 Country alpha-2 to full name
#Thanks for https://github.com/lukes/ISO-3166-Countries-with-Regional-Codes
require 'json'
require 'rest-client'
TEST_LIST = "AT, BE, BG, CY, CZ, DE, DK, EE, ES, FI, FR, GB, GR, HU, IE, IT, LT, LU, LV, MT, NL, PL, PT, RO, SE, SI, SK, US".split(", ")
JSON_URL = 'https://github.com/lukes/ISO-3166-Countries-with-Regional-Codes/raw/master/slim-2/slim-2.json'
response = RestClient.get(JSON_URL)
json = JSON.parse(response)
puts json.select { |j| TEST_LIST.include?(j["alpha-2"]) }.map { |j| j["name"]}.join("\n")
@dacer
dacer / JapaneseCharacter.java
Created January 20, 2018 06:50 — forked from mediavrog/JapaneseCharacter.java
Simple string conversion from Hiragana to Katakana and vice versa. Uses the JapaneseCharacter class from Duane J. May and combines it with a simple Utility class method to perform the actual conversion.
/**
* JapaneseCharacter contains static functions to do various tests
* on characters to determine if it is one of the various types of
* characters used in the japanese writing system.
* <p/>
* There are also a functions to translate between Katakana, Hiragana,
* and Romaji.
*
* @author Duane J. May <djmay@mayhoo.com>
* @version $Id: JapaneseCharacter.java,v 1.2 2002/04/20 18:10:24 djmay Exp $
@dacer
dacer / JMDict.rb
Created February 5, 2018 15:06
translate JMDict
require "sqlite3"
require 'rest-client'
require 'json'
require 'open-uri'
# RestClient.proxy = "http://127.0.0.1:6152"
DB = SQLite3::Database.new "./JMDict(cn+en).sqlite3"
TARGET_LANG = "zh-CN"
def getTranslation(source, currentId)
@dacer
dacer / kot.user.js
Last active February 2, 2021 08:42
kot.user.js
// ==UserScript==
// @name King of Time modification
// @namespace https://dacer.im/
// @version 0.1
// @description Make Kot be better
// @author Dacer
// @grant none
// @include https://*.kingtime.jp/admin/*
// ==/UserScript==
// ==UserScript==
// @name Amazon invoice compressor
// @namespace https://dacer.im/
// @version 0.1
// @description Remove amazon invoice page's custom font
// @author Dacer
// @grant none
// @match https://www.amazon.co.jp/gp/css/summary/print.html/*
// ==/UserScript==
@dacer
dacer / sgtts.user.js
Created February 1, 2021 10:47
sgtts.user.js
// ==UserScript==
// @name Sgtts
// @namespace https://prog-8.com/
// @version 0.1
// @description Say goodbye to Twitter's sidebar (aka Sgtts)
// @author Dacer
// @grant none
// @match https://twitter.com/*
// ==/UserScript==