Skip to content

Instantly share code, notes, and snippets.

View MrOrz's full-sized avatar
💤
Sleepy everyday

Johnson Liang MrOrz

💤
Sleepy everyday
View GitHub Profile
{
"fullTextAnnotation": {
"pages": [
{
"blocks": [
{
"blockType": "TEXT",
"boundingBox": {
"vertices": [
{
@MrOrz
MrOrz / appsscript.json
Last active March 16, 2023 09:31
Cofacts prompt engineering (see https://g0v.hackmd.io/@cofacts/rd/%2F%40cofacts%2FrknFrmdk3 for the project)
{
"timeZone": "Asia/Taipei",
"dependencies": {
},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8",
"oauthScopes": [
"https://www.googleapis.com/auth/spreadsheets.currentonly",
"https://www.googleapis.com/auth/script.external_request"
]
@MrOrz
MrOrz / hash.js
Last active September 3, 2022 16:02
Cofacts collected image scripts
const fs = require('fs/promises');
const { hashes } = require('@cofacts/media-manager');
const sharp = require('sharp');
async function main() {
const path = process.argv[2];
const fd = await fs.open(path);
const [{ size }, { format }] = await Promise.all([
fd.stat(),
@MrOrz
MrOrz / main.gs
Created May 7, 2021 16:07
165 news crawler
/**
* @OnlyCurrentDoc
*/
const DATA_SHEET = '165 民眾通報假投資/博弈詐騙網站';
function getLastDate() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(DATA_SHEET);
const lastRow = sheet.getLastRow();
@MrOrz
MrOrz / .babelrc
Created March 15, 2019 08:15
Reproduce the "SyntaxError: First argument must be tagged template expression. You should use 'msgid' tag" issue
{
"presets": [
"env",
"react"
]
}
{
"type": "bubble",
"header": {
"type": "box",
"layout": "horizontal",
"contents": [
{
"type": "text",
"text": "送出訊息到公開資料庫?",
"weight": "bold",
{
"type": "bubble",
"styles": {
"footer": {
"separator": true
}
},
"body": {
"type": "box",
"layout": "vertical",
@MrOrz
MrOrz / test_readability.js
Created March 19, 2018 16:42
Test web page summarization with Mozilla/Readability.js and puppeteer
const DOC_URL = process.argv[2];
const puppeteer = require('puppeteer');
const fs = require('fs');
const readabilityJsStr = fs.readFileSync('node_modules/readability/Readability.js', {encoding: 'utf-8'})
function executor() {
return new Readability({}, document).parse();
}
[
{
"key_as_string": "2016-12-05",
"key": 1480896000000,
"doc_count": 4,
"user_counts": {
"value": 1
}
},
{
@MrOrz
MrOrz / moveDisplayNameToClass.js
Created May 26, 2017 10:27
This codemod script transforms all anonymous class expressions that extends `React`.* to named class declarations with their `displayName` static property.
/* Converts
export default class extends React.PureComponent {
static displayName = 'Calendar';
...
}
to this:
export default class Calendar extends React.PureComponent {