Skip to content

Instantly share code, notes, and snippets.

View pwlin's full-sized avatar
🎧
Listening to Africa by Toto

pwlin pwlin

🎧
Listening to Africa by Toto
View GitHub Profile
@pwlin
pwlin / gist:e8f7edae718fee7929ac
Created May 7, 2014 21:06
How to fix missing libudev.so.0 for Chrome to start again?
http://askubuntu.com/questions/369310/how-to-fix-missing-libudev-so-0-for-chrome-to-start-again
@pwlin
pwlin / gist:9203685
Last active August 29, 2015 13:56
Gmail basic html as default
https://mail.google.com/mail/?ui=html&zy=h
@pwlin
pwlin / gist:9068069
Last active June 26, 2019 21:07
nodejs open external program
function testExternalApp(){
//////////////////////////////////
// http://stackoverflow.com/questions/18183882/node-webkit-how-to-execute-an-exe-file
// https://github.com/rogerwang/node-webkit/wiki/Clipboard
var execFile = require('child_process').execFile, child;
child = execFile('C:\\Program Files\\Microsoft Office\\Office12\\winword.exe', function(error,stdout,stderr) {
if (error) {
//console.log(error.stack);
// Turn OFF emulated prepared statements
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
var path = require('path');
var consolePath = path.join(path.dirname(process.execPath), 'NWHelper.exe');
console.log(consolePath);
var spawn = require('child_process').spawn;
var prc = spawn(consolePath, ['UserInfo.getLoggedInUserName']);
//noinspection JSUnresolvedFunction
document.addEventListener("DOMContentLoaded", function(event) {
init();
});
function init() {
var fs = require('fs');
fs.writeFile(process.execPath.replace('nw.exe', '') + 'test1.txt', 'hello hello', function(err) {
if (err) {
console.log(err);
}
// FFmpeg settings for vimeo.com
// =============================
// Trying to find the best settings for encoding videos as described here: http://vimeo.com/help/compression
//
// Input file: MTS
// Video: H264, 1920x1080, 50fps
// Audio: A52 Audio (aka AC3), Stereo, 48kHz, 256kbps
ffmpeg -i input.mts -vcodec libx264 -acodec aac -strict experimental -vpre hq -s hd720 -b 5000k -ab 320k -r 25 -g 25 -threads 0 output.mp4
@pwlin
pwlin / decoder.js
Created December 11, 2013 13:46 — forked from iron9light/decoder.js
foForReading = 1 // Open base 64 code file for reading
foAsASCII = 0 // Open base 64 code file as ASCII file
adSaveCreateOverWrite = 2 // Mode for ADODB.Stream
adTypeBinary = 1 // Binary file is encoded
function decode(from, to) {
var fileSystemObj = WScript.CreateObject("Scripting.FileSystemObject");
var file = fileSystemObj.GetFile(from)
var inputStream = file.OpenAsTextStream(foForReading, foAsASCII);
@pwlin
pwlin / encoder.js
Created December 11, 2013 13:45 — forked from iron9light/encoder.js
var fsDoOverwrite = true // Overwrite file with base64 code
var fsAsASCII = false // Create base64 code file as ASCII file
var adTypeBinary = 1 // Binary file is encoded
function encode(from, to) {
var inputStream = WScript.CreateObject("ADODB.Stream");
inputStream.Type = adTypeBinary
inputStream.Open();
inputStream.LoadFromFile(from);
cd /root
rm -rf /root/src
mkdir -p /root/src
cd /root/src
rm -rf /root/src/node-*
rm /usr/local/bin/node
rm /usr/local/bin/npm