Skip to content

Instantly share code, notes, and snippets.

View arunoda's full-sized avatar
👨‍🍳
Cooking something new

Arunoda Susiripala arunoda

👨‍🍳
Cooking something new
View GitHub Profile
@arunoda
arunoda / gist:7790979
Last active February 16, 2024 14:05
Installing SSHPass

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InfiniteMovingBelt : MonoBehaviour
{
public GameObject item;
public float speed = -1f;
public float spawnOffsetFromScreen = 1f;
public float destroyOffsetFromScreen = 1f;
@arunoda
arunoda / README.md
Created November 16, 2017 16:30
Result: ESP 8266 Load Test
@arunoda
arunoda / client.js
Created November 16, 2017 11:47
Node.js HTTP client for ESP8266 Load Test
const http = require('http');
const printHeaders = (() => {
let printed = false
return () => {
if (printed) return
console.log('timestamp, kbps')
printed = true;
}
})();
# add the email package
meteor add email

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel/kptr_restrict=0

perf record -i -g -e cycles:u -- ~/sources/node/node --perf-basic-prof script.js

perf script | egrep -v "( __libc_start| LazyCompile | v8::internal::| Builtin:| Stub:| LoadIC:|\[unknown\]| LoadPolymorphicIC:)" | sed 's/ LazyCompile:[*~]\?/ /' | ~/sources/FlameGraph/stackcollapse-perf.pl > out.perf-folded
@arunoda
arunoda / 0README.md
Last active March 20, 2018 08:52
V8 Memory Usage

V8 Mem Test

This is test about, how V8 caches internal objects and how it affects with the Memory. But there is no good way to findout the exact amount of memory used by given set of objects without profiling. So, we are using gc() with following steps to pick a decent value.

For that, you need to run following scripts with --expose gc NodeJS option.

@arunoda
arunoda / next.config.js
Created May 3, 2017 16:52
Stop uglifying in Next.js
module.exports = {
webpack: function (cfg) {
cfg.plugins = cfg.plugins.filter(plugin => {
return plugin.constructor.name !== 'UglifyJsPlugin';
});
return plugin
}
}
{
"scripts": {
"dev": "next",
"build": "next build",
"export": "next export"
}
}
const express = require('express')
const next = require('next')
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()
app.prepare()
.then(() => {
const server = express()