Skip to content

Instantly share code, notes, and snippets.

@pingyen
pingyen / fb-sharer-vexed.js
Last active October 31, 2023 05:03
P_Vexed Sharer
// ==UserScript==
// @name P_Vexed Sharer
// @namespace https://www.facebook.com/groups/p.vexed
// @version 0.1
// @description Facebook Sharer + P_Vexed
// @author You
// @match https://www.facebook.com/sharer/sharer.php*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
@pingyen
pingyen / twd97Conv.php
Last active April 30, 2023 15:47
Transform TWD97 to Latitude Longitude
<?php
function twd97_to_latlng($x, $y) {
$a = 6378137.0;
$b = 6356752.314245;
$lng0 = 121 * M_PI / 180;
$k0 = 0.9999;
$dx = 250000;
$dy = 0;
$e = pow((1 - pow($b, 2) / pow($a, 2)), 0.5);
@pingyen
pingyen / gtranslateLanguages.json
Created March 17, 2021 09:14
Google Translate Languages
{
"af": "Afrikaans",
"am": "Amharic",
"ar": "Arabic",
"az": "Azerbaijani",
"be": "Belarusian",
"bg": "Bulgarian",
"bn": "Bengali",
"bs": "Bosnian",
"ca": "Catalan",
@pingyen
pingyen / jsonBeautifier.php
Last active September 24, 2019 16:06
Beautify JSON files
<?php
$path = call_user_func(function() {
global $argv;
return isset($argv[1]) === true ?
$argv[1] :
'.';
});
function findJSONFiles($path) {
@pingyen
pingyen / dedupLines.php
Created September 17, 2019 07:22
Remove duplicate lines in a file
<?php
$targets = array_slice($argv, 1);
foreach ($targets as $target) {
$map = array();
foreach (explode("\n", file_get_contents($target)) as $line) {
if (isset($map[$line]) === true) {
continue;
}
@pingyen
pingyen / base.js
Created September 20, 2012 10:04
WinJS base.js
/// <loc filename="Metadata\base_loc_oam.xml" format="messagebundle" />
/*!
© Microsoft. All rights reserved.
This library is supported for use in Windows Store apps only.
Build: 1.0.9200.20498.win8_ldr.120817-1716
Version: Microsoft.WinJS.1.0
*/
@pingyen
pingyen / googleNewsLangRegionList.json
Created January 9, 2019 08:44
Google News Language & Region List
[
[
"CN:zh-Hans",
"中文 | 中国",
"CN",
"zh-Hans"
],
[
"TW:zh-Hant",
"中文 | 台灣",
@pingyen
pingyen / console.js
Last active December 6, 2018 03:16
Simple JavaScript console.log for Browsers without console
(function() {
var div = document.createElement('div');
div.style.cssText = [
'position: fixed',
'bottom: 10px',
'right: 10px',
'padding: 10px',
'background: yellow',
'z-index: 2147483647'
@pingyen
pingyen / plurkBot.php
Last active October 20, 2018 22:14
Plurk Bot
<?php
define('NICKNAME', 'abc');
define('PASSWORD', 'iamabc');
define('USER_ID', '123456');
$message = 'Hello World!';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
@pingyen
pingyen / countries.csv
Created September 18, 2018 08:29
Country Name, 2-Letter, 3-Letter Code CSV
Afghanistan AF AFG
Aland Islands AX ALA
Albania AL ALB
Algeria DZ DZA
American Samoa AS ASM
Andorra AD AND
Angola AO AGO
Anguilla AI AIA
Antarctica AQ ATA
Antigua and Barbuda AG ATG