Skip to content

Instantly share code, notes, and snippets.

@goooooouwa
goooooouwa / node_module.js
Last active July 21, 2025 04:25
nodejs basic module syntax #nodejs #module #javascript
// in module1.js
function a(){
console.log('hello');
}
module.exports.a = a;
// in module2.js
@goooooouwa
goooooouwa / node-orm-demo.js
Last active August 2, 2017 03:58
demo on how to use node.js orm to find all records and match text with LIKE. 关于如何使用node.js orm查询全部记录和LIKE文本匹配的demo。 https://github.com/dresende/node-orm2
// how to find all Person records
// 如何查找所有人的记录
Person.find() // or Person.all()
// how to find Person records with surname beginning with word "Gr"
// 如何查找surname以“Gr"字母开头的人的记录
Person.find({ surname: orm.like("Gr" + "%") })
var anim = this.node.getChildByName("flashLight").getComponent(cc.Animation);
// these 3 steps must in order to play and pause the animation at 0.5s
anim.setCurrentTime(0.5, 'flashLight');
anim.play("flashLight");
anim.pause('flashLight');
this.render().then(() => {
// these 2 steps must in order to resume the animation from 0.5s
anim.setCurrentTime(0.5, 'flashLight');
anim.resume("flashLight");
});
@goooooouwa
goooooouwa / import-card-diary-to-jekyll.js
Last active July 21, 2025 04:23
#jekyll #card-diary
var fs = require('fs');
const contents = fs.readFileSync('CardDiary-JSON.json', 'utf8');
const obj = JSON.parse(contents);
for (const d of obj.diaryExports) {
const diary = JSON.parse(d.content);
const date = d.createDate.substring(0, 10);
const filename = `${date}-${diary.title || 'log'}`;
@goooooouwa
goooooouwa / send-markdown-to-evernote.sh
Last active July 21, 2025 04:16
#evernote #markdowwn
for filename in ./_drafts/*.md; do
echo $filename
date=$(echo $filename | cut -c 11-20)
title=$(echo $filename | cut -c 22- | rev | cut -c 4- | rev)
geeknote create --title "$title" --created "$date" --content "$filename"
done
@goooooouwa
goooooouwa / Subscriptions.opml
Last active July 21, 2025 04:16
extract rss feed urls from opml file #rss #opml
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Subscriptions - RSS</title>
</head>
<body>
<outline htmlUrl="http://newworldinteractive.com" title="Blog – New World Interactive" xmlUrl="http://newworldinteractive.com/blog/feed/" type="rss" text="Blog – New World Interactive"/>
<outline htmlUrl="http://www.steampowered.com/" title="New On Steam" xmlUrl="https://store.steampowered.com/feeds/newreleases.xml" type="rss" text="New On Steam"/>
<outline htmlUrl="https://goooooouwa.github.io/" title="Shunfa’s Blog" xmlUrl="https://goooooouwa.github.io/feed.xml" type="rss" text="Shunfa’s Blog"/>
<outline title="test" xmlUrl="tag/test" type="rss" text="test"/>
@goooooouwa
goooooouwa / CardDiaryTXT.txt
Last active July 21, 2025 04:16
break CardDiary export txt file into individual diary txt files with date as title. So that I can import these text files into Evernote. #evernote #card-diary
Date: 2018-09-25 16:29:58
Weather: Cloudy
Demo diary post 1
Date: 2018-09-26 19:05:07
Weather: Mostly Cloudy Day
Demo diary post 2
@goooooouwa
goooooouwa / build-qtopia.sh
Last active July 21, 2025 04:13
#qt #qtopia #embedded-linux
#!/bin/bash
echo INFO: host: red hat 9.0 with all packages in installation CDs installed.
echo INFO: target: armv4tl Linux 2.6.12-h1940 libc 2.3.2
echo INFO: all operations are executed under root
#build mode
INSTALL_CROSSTOOL=""
COPY_LIBS=""
COMPILE_QT=""
@goooooouwa
goooooouwa / common-shell-commands.sh
Last active July 21, 2025 04:08
Common shell commands #bash #find #sed
#!/bin/bash
# bash for loop
for i in $(seq 10 $END); do
echo $i
done
# 1.Iterate over collection
for i in a b c; do
echo $i
xargs -n 1 curl -O -L --retry 5 --retry-max-time 60 -C - < ./mp3-urls-unique-id-fix.txt