Skip to content

Instantly share code, notes, and snippets.

andineck / buffer-gt-0x80.js
Last active Aug 29, 2015
Buffer.toString() encoding
View buffer-gt-0x80.js
var assert = require('assert');
var buf, buf2;
buf = new Buffer([0x00, 0x41, 0x7f]);
buf2 = new Buffer(buf.toString());
//console.log(buf, buf2);
// -> <Buffer 00 41 7f> <Buffer 00 41 7f>
assert(buf2.equals(buf), 'buffer with normal acii chars can be converted to string and back');
assert.equal(buf2.length, 3);
andineck / file.ps1
Created Apr 22, 2015
powershell read write file
View file.ps1
$filePath = "test.txt"
# write append to file
echo 'halloo' >> $filePath
# write empty file
echo $null > $filePath
andineck / email.ps1
Created Apr 23, 2015
powershell send email
View email.ps1
# email-subscribers.dat is a file with email adresses separated by newline
# SmtpServer must be provided
$emails = Get-Content email-subscribers.dat
foreach($email in $emails) {
Send-MailMessage -From "" -To $email -Subject "howzit" -Body "long time no see" -SmtpServer ""
andineck / 1
Last active Aug 29, 2015
Javascript Member Variables done properly
View 1

javascript member variables

know the difference between shared and instance specific member variables in javascript.

andineck / path-to-regexp#54.js
Created May 12, 2015
path-to-regexp PR54 tests.
View path-to-regexp#54.js
// patch: "path-to-regexp": "git://"
var patch = require('./patch/node_modules/path-to-regexp');
// old: "path-to-regexp": "^0.1.3"
var old = require('./0.1.3/node_modules/path-to-regexp');
var assert = require('assert');
// routes: 0: route, 1: path, 2: param
var routes = [
['*', '/test/route/aA/bB/cC', '/test/route/aA/bB/cC'],
andineck / 1
Last active Aug 29, 2015
shared module
View 1

node.js module hickups

modules in node are great. sharing them in npm is even better.

  • make sure you understand, that module when you require the same module from within the same directory, you get the reference to the same thing.
  • if you require the same module in files wich are located in different directories, you get two new module instances.


node b.js
andineck / 1
Last active Aug 29, 2015
javascript variables
View 1

understand javascript variables


node variables.js
sudo apt-get update # Fetches the list of available updates
sudo apt-get upgrade # Strictly upgrades the current packages
sudo apt-get dist-upgrade # Installs updates (new ones)
andineck /
Last active Sep 2, 2015
github: add repo via command line

github cmd

  1. how to create and init a git repository
  2. how to create and init a git repository for an organization