Skip to content

Instantly share code, notes, and snippets.

View ngs's full-sized avatar
🎣
Fly Fishing

Atsushi NAGASE ngs

🎣
Fly Fishing
View GitHub Profile
<?php
$str = "=?UTF-8?B?44GC44GE44GG44GI44GK44GC44GE44GG44GI44GK44GC44GE44GG44GI44GK?=";
$ar = explode("?", $str);
$encoded = $ar[3];
$decoded = base64_decode($encoded);
echo $decoded;
?>
document.getElementById('lottie').addEventListener('click', e => {
const elements = [].concat.apply([], anim.projectInterface.compositions.map(e => e.elements));
const baseElements = elements.map(elm => elm.baseElement);
let element = e.target;
let found = null;
while(element && /^(g|path)$/.test(element.nodeName)) {
let idx = baseElements.indexOf(element);
if (idx !== -1) {
found = elements[idx];
break;
@ngs
ngs / setup.sh
Last active March 9, 2019 01:05
brew install v8-315
bundle config --local build.libv8 --with-system-v8
bundle config —local build.charlock_holmes --with-cppflags=-DU_USING_ICU_NAMESPACE=1 --with-cxxflags=-std=c++11
bundle config --local build.therubyracer --with-v8-dir=$(brew --prefix v8-315)
@ngs
ngs / decl.js
Last active January 8, 2023 15:49
[].slice.call(document.querySelectorAll('#content > div.fixedFont'), 0).map(function(i, n){
const text = i.innerText;
let desc = i.nextSibling;
while(desc && desc.className !== 'description') {
desc = desc.nextSibling;
}
const m = text.match(/\{([^\}]+)\}\s(.+)$/) || ['', 'void', text];
const retType = m[1];
const fn = m[2];
return '/**\n * ' + desc.innerText.replace(/\n/g, '\n * ') + '\n */\n' + fn + ': ' + retType + ';';
@ngs
ngs / fill-quotes.js
Created February 27, 2019 20:09
Auto fill MoneyForward quotes
let unitPrice = ...;
let subjects = `...`.split(/\n/g);
let quantities = `...`.split(/\n/g)
while($('.js-css-item-row').size() < subjects.length + 1) {
$('#js-add-item').click()
$('.js-css-item-row:last #quote_quote_items_attributes__unit_price').val(unitPrice)
}
subjects.forEach((s, i) => $(`.js-css-item-row:eq(${i}) #quote_quote_items_attributes__name`).val(s))
@ngs
ngs / index.js
Last active February 19, 2019 15:38
Verify License
const crypto = require('crypto');
const https = require('https');
const { parseString } = require('./xml2js/xml2js');
exports.handler = (event, context, callback) => {
let { token } = event;
let buf = Buffer.from(token, 'base64');
let xml = buf.toString().replace(/\u0000/g, '');
https.get('https://verificationservice.officeapps.live.com/ova/verificationagent.svc/rest/verify?token=' + encodeURIComponent(xml), (resp) => {
Alt(右)           E038
Alt(左)           38
Ctrl(右)          E01D
Ctrl(左)          1D
Shift(右)         36
Shift(左)         2A
Win(右)           E05C
Win(左)           E05B
Application       E05D
btoa([].slice.call(window.crypto.getRandomValues(new Uint8Array(4096))).map((n) => String.fromCharCode(n)).join(''))
@ngs
ngs / allCSS.js
Last active January 8, 2023 15:48
// https://developer.mozilla.org/en-US/docs/Web/API/StyleSheetList
var allCSS =
[].slice.call(document.styleSheets)
.reduce(function (prev, styleSheet) {
try {
return prev +
[].slice.call(styleSheet.cssRules)
.reduce(function (prev, cssRule) {
return prev + cssRule.cssText;
var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this.parsedData=[];for(var b=[],d=0,e=this.data.length;e>d;d++){var f=this.data.charCodeAt(d);f>65536?(b[0]=240|(1835008&f)>>>18,b[1]=128|(258048&f)>>>12,b[2]=128|(4032&f)>>>6,b[3]=128|63&f):f>2048?(b[0]=224|(61440&f)>>>12,b[1]=128|(4032&f)>>>6,b[2]=128|63&f):f>128?(b[0]=192|(1984&f)>>>6,b[1]=128|63&f):b[0]=f,this.parsedData=this.parsedData.concat(b)}this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function b(a,b){this.typeNumber=a,this.errorCorrectLevel=b,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function i(a,b){if(void 0==a.length)throw new Error(a.length+"/"+b);for(var c=0;c<a.length&&0==a[c];)c++;this.num=new Array(a.length-c+b);for(var d=0;d<a.length-c;d++)this.num[d]=a[d+c]}function j(a,b){this.totalCount=a,this.dataCount=b}function k(){this.buffer=[],this.length=0}function m(){return"undefined"!=typeof CanvasRender