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 / 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.

<head>
<title>abc</title>
</head>
<body>
{{#sourceCode}}
<template name="books">
<input type="text" placeholder="Search..." value="{{booksSearchQuery}}">
{{#if searchResults.count}}
var DDPClient = require('ddp');
var totalClients = 0;
var postsList = 0;
var postsListUsers = 0;
var postsList
function createClient(closeTimeout) {
console.log('CREATING....', closeTimeout);
var client = new DDPClient({
@arunoda
arunoda / cpu-watch.js
Last active August 29, 2015 13:56
Lookup CPU usage in details
/*
USAGE: node cpu-watch.js <pid> <how-many-minutes>
*/
var fs = require('fs');
var format = require('util').format;
var PID = process.env.PID || process.argv[2];
if(!PID) throw new Error('No PIC Provided!');
var ENDIN_MINUTES = process.env.ENDIN_MINUTES || process.argv[3];
@arunoda
arunoda / gist:7790979
Last active March 13, 2025 14:30
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

{
users: [
{},
{}
]
}
Meteor.methods({
searchPosts: function(term) {
console.log('-- searching for "'+term+'" --')
Future = Npm.require('fibers/future');
var fut = new Future();
Meteor._RemoteCollectionDriver.mongo.db.executeDbCommand({
"text": "posts",
search: term
}, function (error,results){
#!/bin/bash
cd ~/
#checkout repo
cd app.git
git pull origin master
git checkout master
cd ..
@arunoda
arunoda / 1.docs.md
Last active March 18, 2016 21:18
Meteor Latency Compensation - The Correct Way

##Meteor Latency Compensation - The Correct Way

This is a kind of correction I wan't make regards to the concept describe in discover-meteor book

For the latency compensation to occur we cloud simply share the same method in the client/server. We can do this by simply putting the method under a place which can see by bot the server and client.

But practically(not all the time) we should not do that. In the server code we might have some logic which should not share. Or simply we might have some secret tokens.

So the correcy approach is define the method (in this case post) seperately in the two context. as shown below

@arunoda
arunoda / index.html
Created April 7, 2012 06:40
How kodeincloud HTML5 API looks like
<!DOCTYPE html>
<html>
<head>
<title>kodeincloud HTML5</title>
<script type="text/javascript" src="http://static.kodeincloud.com/html5.min.js?appkey=3f76818f507fe7eb6422bd0703c64c88"></script>
<script type="text/javascript">
kic.invoke('hello', {name: "arunoda susiripala"}, function(err, resp) {