Skip to content

Instantly share code, notes, and snippets.

@bendiy
bendiy / emrk-reinstall-custom.sh
Last active January 15, 2019 21:55 — forked from davidbeauchamp/emrk-reinstall-custom.sh
EdgeMax Recovery Kit Customized Script
#!/bin/sh
#
# emrk-reinstall: EdgeOS installer
#
# Maintainer: Daniil Baturin <daniil at baturin dot org>
#
# Copyright (C) 2013 SO3Group
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@bendiy
bendiy / windows-local-nodejs-server.md
Created January 5, 2018 04:30
Setup Windows as a Local Node.js Server Environment

How to Setup Windows as a Node.js Server Environment

Install the following in this order:

  1. cmder | Console Emulator for Windows. Use the Download Full link.
    • Download and unzip into C:\Users\your-username-here\cmder.
    • Open the C:\Users\your-username-here\cmder directory right click on cmdre.exe click Pin to Taskbar.
  2. nvm-windows | Node Version Manager for Windows.
    • Download nvm-setup.zip.
    • Extract the nvm-setup.exe file somewhere and run it.
var http = require('http'),
ursa = require("ursa"),
forge = require("node-forge"),
ursaStart,
ursaFinish,
forgeStart,
forgeFinish;
//http.createServer(function (req, res) {
//res.writeHead(200, {'Content-Type': 'text/plain'});
@bendiy
bendiy / gist:7553882
Created November 19, 2013 22:41
Server Benchmarks
mkdir io-test
cd io-test/
wget www.iozone.org/src/current/iozone3_413.tar
tar -xvf iozone3_413.tar
rm iozone3_413.tar
cd iozone3_413/src/current/
make linux-AMD64
./iozone -RazMb io-test.xls
@bendiy
bendiy / gist:5688443
Last active August 19, 2021 13:20
PHP xkcd password generator for *nix systems
<?php
/*
* Generate xkcd style password from /usr/share/dict/words
*
* http://xkcd.com/936/
* apt-get install wamerican
*/
function xkcd_password_generator() {
$lines = file('/usr/share/dict/words', FILE_IGNORE_NEW_LINES);
@bendiy
bendiy / gist:5374872
Created April 12, 2013 20:26
XM.Contact REST API Discovery Document
{
"kind":"discovery#restDescription",
"etag":"",
"discoveryVersion":"v1alpha1",
"id":"dev:v1alpha1",
"name":"dev",
"version":"v1alpha1",
"revision":"20130412",
"title":"xTuple ERP REST API",
"description":"Lets you get and manipulate xTuple ERP business objects.",
@bendiy
bendiy / gist:4355956
Created December 21, 2012 21:27
validate sessions
/*jshint node:true, indent:2, curly:false, eqeqeq:true, immed:true, latedef:true, newcap:true, noarg:true,
regexp:true, undef:true, strict:true, trailing:true, white:true */
/*global X:true */
(function () {
"use strict";
var _fs = X.fs, _path = X.path, salt, crypt;
/**
@bendiy
bendiy / api.js
Created December 7, 2012 00:30
Test REST Server Route
/*jshint node:true, indent:2, curly:false, eqeqeq:true, immed:true, latedef:true, newcap:true, noarg:true,
regexp:true, undef:true, strict:true, trailing:true, white:true */
/*global X:true */
(function () {
"use strict";
var _ = X._;
// https://localtest.com/api?recordType=XM.File&id=40
@bendiy
bendiy / gist:4229692
Created December 7, 2012 00:27
Database call to dispatch
SELECT xt.js_init();
select xt.dispatch($${"username": "admin",
"requestType":"dispatch",
"className":"XT.Schema",
"functionName":"columnInfo",
"parameters": ["public.custinfo","cust_id"],
"isJSON": true
}$$);