Skip to content

Instantly share code, notes, and snippets.

View ruslander's full-sized avatar

Ruslan Rusu ruslander

View GitHub Profile
@ruslander
ruslander / Makefile
Created January 19, 2020 02:04
Makefile for Go Projects
GOPATH=$(shell pwd)/vendor:$(shell pwd)
GOBIN=$(shell pwd)/bin
GOFILES=$(wildcard *.go)
GONAME=$(shell basename "$(PWD)")
PID=/tmp/go-$(GONAME).pid
build:
@echo "Building $(GOFILES) to ./bin"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go build -o bin/$(GONAME) $(GOFILES)
@ruslander
ruslander / exporter-prometheus-grafana.txt
Last active January 7, 2020 02:18
setup exporter prometheus grafana
Node Exporter
-----------------------------------------------------------------------------------------------------------------
curl -Lo /etc/yum.repos.d/_copr_ibotty-prometheus-exporters.repo https://copr.fedorainfracloud.org/coprs/ibotty/prometheus-exporters/repo/epel-7/ibotty-prometheus-exporters-epel-7.repo
yum install -y node_exporter
sudo echo 'kernel.perf_event_paranoid=-1' > '/etc/sysctl.d/51-enable-perf-events.conf'
@ruslander
ruslander / parallel_queue.pl
Created September 7, 2019 16:41
multiple wrongs don't make it right
Parallel queues model with PDQ
Took as an example the "Internet Provider" from "The practical Performance Analyst".
#!/usr/bin/perl
use pdq;
# Globals
$arrivRate = 3;
@ruslander
ruslander / perf-vpc-public-subnet.js
Created March 27, 2019 03:38
pulumi - perf - topology
"use strict";
const aws = require("@pulumi/aws");
let size = "t1.micro";
let ami = "ami-0ac019f4fcb7cb7e6";
let localKey = "local-mac";
let nodes = [];
@ruslander
ruslander / Chat.java
Created April 3, 2017 17:01 — forked from yuvadm/Chat.java
JGroups TCP over WAN
import org.jgroups.JChannel;
import org.jgroups.Message;
import org.jgroups.ReceiverAdapter;
import org.jgroups.View;
import org.jgroups.util.Util;
public class Chat {
public static void main(String[] args) throws Exception {
JChannel ch = new JChannel("tcp.xml");
@ruslander
ruslander / suspector.cs
Created December 9, 2016 23:53
Detect corrupted charts
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
namespace TooMuchWhite
{
class Program
{
@ruslander
ruslander / talk-notes
Created November 10, 2016 15:16
4+1 architectural view model
Logical view
Code and its structures 5:26
Process view
How the elements of code gets packaged in units of deployment
Physical view
How those get plugged to phisical machines
Scenarios
@ruslander
ruslander / wk2.java
Last active October 23, 2016 01:25
Second week algorhitms
public class FractionalKnapsack {
public static class Loot implements Comparable{
public Loot(int i, int v, int w){
Index = i;
Ratio = (double)v / w;
Weight = w;
Benefit = v;
}
using System;
using System.Configuration;
using System.Linq;
using Microsoft.WindowsAzure.Storage;
using Newtonsoft.Json;
using Streamstone;
namespace InServiceCqrs
{
class Program
@ruslander
ruslander / wk1.java
Last active October 12, 2016 01:24
First week algorhitms
public class FibonacciLastDigit {
private static int getFibonacciLastDigit(int n) {
if (n <= 1)
return n;
int previous = 0;
int current = 1;
for (int i = 0; i < n - 1; ++i) {