Skip to content

Instantly share code, notes, and snippets.

View sbilello's full-sized avatar

Sergio Bilello sbilello

View GitHub Profile
@RequestMapping(value = "/hola", method = RequestMethod.GET)
public String hola(Model model,
@ModelAttribute("command") Object command,
BindingResult results,
RedirectAttributes redirectAttributes ) {
model.addAttribute("command", command);
ValidationUtils.invokeValidator(validator, command, results);
if (results.hasErrors()) {
redirectAttributes.addFlashAttribute("errors", results.getAllErrors());
@sbilello
sbilello / gist:fe36c51afd06717c47ae
Created June 20, 2014 09:08
Arithmetic progression
import java.io.*;
import java.lang.Math;
public class Solution {
public static void main(String args[] ) throws Exception {
String line = null;
try {
BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
line = is.readLine();
line = is.readLine();
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
@sbilello
sbilello / running
Created October 23, 2015 22:41
running nodes
java -Dconfig.file=applicationGuest.conf -Ddraios.cassandra.auto-schema=true -Dlogging.level.com.draios.rest.api.controllers.DataController=DEBUG -Dlogging.level.com.draios.storage.services.ProtobufReaderService=DEBUG -Dlogging.level.com.draios.storage.dao.ProtobufDAO=INFO -Dlogging.level.com.draios.storage.services.ProtobufAggregatorService=DEBUG -Dlogging.level.com.draios.storage.dao.ConnectedAgentsDAO=INFO -Dlogging.level.com.draios.aws.service.AWSMetricsStorageService=DEBUG -Dspring.profiles.active=staging,collector -Xms2g -Xmx2g -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+UseTLAB -XX:+CMSParallelInitialMarkEnabled -XX:+CMSEdenChunksRecordAlways -XX:CMSWaitDuration=10000 -XX:+UseCondCardMark -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Djava.rmi.server.hostname=172.16.195.158 -jar draios-backend-1.0.0.jar
@sbilello
sbilello / resource_alloc_docker.md
Created October 10, 2016 20:45 — forked from afolarin/resource_alloc_docker.md
Resource Allocation in Docker

#Container Resource Allocation Options in docker-run You have various options for controlling resources (cpu, memory, disk) in docker. These are principally via the docker-run command options.

##Dynamic CPU Allocation -c, --cpu-shares=0
CPU shares (relative weight, specify some numeric value which is used to allocate relative cpu share)

##Reserved CPU Allocation

@sbilello
sbilello / install.sh
Created October 10, 2016 21:55 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@sbilello
sbilello / gist:cb3afb996b3f1b01537fecbbbfbd311f
Created March 25, 2017 06:16 — forked from ngocdaothanh/gist:3764694
Scala Assignment: Recursion
package recfun
import scala.collection.mutable.ListBuffer
import common._
/** https://class.coursera.org/progfun-2012-001/assignment/view?assignment_id=4 */
object Main {
def main(args: Array[String]) {
println("Pascal's Triangle")
for (row <- 0 to 10) {
@sbilello
sbilello / readme.adoc
Created June 13, 2017 17:18 — forked from arun-gupta/readme.adoc
Kubernetes Cluster on AWS
  1. kops: https://github.com/kubernetes/kops

    1. Getting Started Guide: https://github.com/kubernetes/kops/blob/master/docs/aws.md

    2. Installing Kubernetes on AWS with kops: https://kubernetes.io/docs/getting-started-guides/kops/

    3. Mulit-master Kubernetes Cluster on AWS with kops: http://blog.arungupta.me/multimaster-kubernetes-cluster-amazon-kops/

    4. Booting Kubernetes on Amazon Elastic Compute with kops: https://deis.com/docs/workflow/quickstart/provider/aws/boot/

    5. Setting up an HA Kubernetes Cluster in AWS with private topology with kops 1.5.1: https://www.nivenly.com/kops-1-5-1/

    6. Kubernetes on AWS: https://daemonza.github.io/2017/01/15/kubernetes-on-aws/

    7. Your 2nd day with Kubernetes on AWS: https://www.nivenly.com/2nd-hour/

  2. Tectonic (Terraform): http://github.com/coreos/tectonic-installer

@sbilello
sbilello / Tries.java
Created August 11, 2017 22:56
Tries.java
public class Tries {
public static void main(String[] args) {
Node n = new Node();
n.add("ciao");
n.add("ciaone");
n.printWords();
System.out.println();
n.delete("ciaone");
@sbilello
sbilello / balance.html
Last active December 13, 2017 07:19
fixedWeb3InteractionContractWithWallet
<!doctype>
<html>
<head>
<script type="text/javascript">
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider());
var contract_address = "0xDaC6a77a0Fd7c7409e00197003Ed7583E28Ec5A4";