Skip to content

Instantly share code, notes, and snippets.

View rajcspsg's full-sized avatar

RAJKUMAR NATARAJAN rajcspsg

View GitHub Profile
@rajcspsg
rajcspsg / Mining
Last active November 21, 2017 02:31
setting up single/multi node Ethereum
1. miner.start(true)
2. miner.stop()
3. eth.blockNumber (this returns the id of last/latest block of ethereum)
4. eth.getBalance (to view the miner's account balance)
5. eth.getBlock(eth.blockNumber).miner (returns the id of the last/latest block miner)
6. eth.getBalance(eth.getBlock(eth.blockNumber).miner)
@rajcspsg
rajcspsg / gist:64a1b9e97da8509b4eaa5daf8c86bc00
Created March 27, 2018 20:49
The Node.js Event Loop: Not So Single Threaded
https://www.youtube.com/watch?v=zphcsoSJMvM
1. single threaded process
2. co-operative multi tasking
Application running on the operating system should yield the OS.
Once the application has yielded then the OS run the other tasks.
This has a big flaw if the application doesn't yield, then the OS will wait for long time.
3. pre-emptive multi tasking
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mycompany</groupId>
<artifactId>adserving</artifactId>
<version>4.7.2</version>
<relativePath>..</relativePath>
</parent>
$ cat /home/vagrant/hs_err_pid5124.log
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 536870912 bytes for committing reserved memory.
# Possible reasons:
# The system is out of physical RAM or swap space
# In 32 bit mode, the process size limit was hit
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
@rajcspsg
rajcspsg / gist:024ab1e8525e5357dd44d47b1b33372b
Last active April 20, 2019 03:14
strace for minidcos vagrant web 2019.04.18.2
stat("/tmp/_MEInfj5pi/botocore/data/appmesh/2019-01-25", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
openat(AT_FDCWD, "/tmp/_MEInfj5pi/botocore/data/appmesh/2019-01-25", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 7
fstat(7, {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
getdents(7, /* 4 entries */, 32768) = 128
stat("/tmp/_MEInfj5pi/botocore/data/appmesh/2019-01-25/paginators-1.json", {st_mode=S_IFREG|0700, st_size=996, ...}) = 0
unlink("/tmp/_MEInfj5pi/botocore/data/appmesh/2019-01-25/paginators-1.json") = 0
stat("/tmp/_MEInfj5pi/botocore/data/appmesh/2019-01-25/service-2.json", {st_mode=S_IFREG|0700, st_size=110890, ...}) = 0
unlink("/tmp/_MEInfj5pi/botocore/data/appmesh/2019-01-25/service-2.json") = 0
getdents(7, /* 0 entries */, 32768) = 0
close(7) = 0
@rajcspsg
rajcspsg / Regs.java
Created August 6, 2019 21:57
Generated sample Java
package com.technorati.openrtb.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: main/proto/datamodel.proto
package part2;
public final class Datamodel {
private Datamodel() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
@rajcspsg
rajcspsg / gist:26e24f5fd955d635152c0d43a4b63647
Created October 7, 2019 04:04
docker data node start issue
[vagrant@master docker-hadoop-master]$ docker service logs hadoop_datanode
hadoop_datanode.0.bwruqadoq28r@master.com | Configuring core
hadoop_datanode.0.bwruqadoq28r@master.com | - Setting hadoop.proxyuser.hue.hosts=*
hadoop_datanode.0.bwruqadoq28r@master.com | - Setting fs.defaultFS=hdfs://namenode:9000
hadoop_datanode.0.bwruqadoq28r@master.com | - Setting hadoop.http.staticuser.user=root
hadoop_datanode.0.bwruqadoq28r@master.com | - Setting io.compression.codecs=org.apache.hadoop.io.compress.SnappyCodec
hadoop_datanode.0.bwruqadoq28r@master.com | - Setting hadoop.proxyuser.hue.groups=*
hadoop_datanode.0.bwruqadoq28r@master.com | Configuring hdfs
hadoop_datanode.0.bwruqadoq28r@master.com | - Setting dfs.datanode.data.dir=file:///hadoop/dfs/data
hadoop_datanode.0.bwruqadoq28r@master.com | - Setting dfs.namenode.datanode.registration.ip-hostname-check=false
managers=3
workers=3
for node in $(seq 1 $managers); do echo "======> Creating manager$node machine ..."; docker-machine create -d virtualbox manager$node; done
for node in $(seq 1 $workers); do echo "======> Creating worker$node machine ..."; docker-machine create -d virtualbox worker$node; done
docker-machine ssh manager1 "docker swarm init --listen-addr $(docker-machine ip manager1) --advertise-addr $(docker-machine ip manager1)"
export manager_token=`docker-machine ssh manager1 "docker swarm join-token manager -q"`
export worker_token=`docker-machine ssh manager1 "docker swarm join-token worker -q"`
for node in $(seq 2 $managers); do echo "======> manager$node joining swarm as manager ..."; docker-machine ssh manager$node "docker swarm join --token $manager_token --listen-addr $(docker-machine ip manager$node) --advertise-addr $(docker-machine ip manager$node) $(docker-machine ip manager1)"; done
for node in $(seq 1 $workers); do echo "======> worker$node joining swarm as worker ..."; docker-machine ssh w
@rajcspsg
rajcspsg / .spacemacs
Last active May 10, 2020 10:03
spacemacs configuration
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default