Skip to content

Instantly share code, notes, and snippets.

View zyxar's full-sized avatar
👑
I may be slow to respond.

Markus zyxar

👑
I may be slow to respond.
  • Singapore
View GitHub Profile
@zyxar
zyxar / teamwork.sh
Created December 29, 2011 07:26
Cluster Server Distribution
#!/bin/bash
CLIENT=/opt/bin/redis-cli
HOSTING_SERVER="brick5"
HOSTING_PORT=6379
REQUEST="${CLIENT} -h ${HOSTING_SERVER}"
ALL_WORKING_SERVERS_SET="locked_server"
@zyxar
zyxar / EnvMonitor.java
Created February 18, 2012 10:24
A Environment Monitor
package org.apache.hadoop.hbase.regionserver;
import java.awt.Color;
import java.awt.Font;
import java.io.File;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.management.ManagementFactory;
@zyxar
zyxar / hack.sh
Created March 31, 2012 12:05 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@zyxar
zyxar / pigenr.go
Created April 6, 2012 05:01
π's nth hexadecimal digit generator
/*
This program implements the BBP algorithm to generate a few hexadecimal
digits beginning immediately after a given position id, or in other words
beginning at position id + 1. The original C version was implemented by
David H. Bailey.
*/
/*
Marcus Zy 06-04-2012 "Good Friday"
This is my first ever 'go' program.
*/
@zyxar
zyxar / exercise.tour.go
Last active October 31, 2024 22:30
tour.golang exercise solutions
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
@zyxar
zyxar / fib.go
Created October 9, 2012 03:34
naive solution to acm-icpc-2012-problems
package main
//problem d
import (
"fmt"
)
var lm []int64
@zyxar
zyxar / stackseq.go
Created October 11, 2012 05:08
solution to #amazon hiring final4 test2: stack sequence
package main
import (
"fmt"
"strconv"
"strings"
"os"
"bufio"
)
@zyxar
zyxar / parseconf.cc
Created October 16, 2012 11:07
#amazon hiring 2012-2013 final 6 test 2 & solution
/*consider a kind of configuration file in amazon sofeware system. this kind of configuration file's format looks like this:
B=10;
A={
A=100;
B=BDE;
@zyxar
zyxar / shifts.cc
Created October 21, 2012 17:15
misc. c plus plus exercises
#include <iostream>
#include <string>
#define swap(a, b) { \
a ^= b; \
b ^= a; \
a ^= b;}
std::string& reverse(std::string& str, int start, int end) {
if (end == start) return str;
@zyxar
zyxar / equation.cc
Created October 27, 2012 11:26
#amazon hiring 2012-2013 final unknown
/*Question:
Given an array with positive integers and another integer for example{7 2 4} 9, you are required to generate an equation, by inserting operator add ("+") and minus ("-") among the array . The left side of equation are consist of the array and the right side of equation is the integer. here the result is 7-2+4=9
Rules:
Don't include any space in the generated equation.
In case there is no way to create the equation, please output "Invalid". For example {1 1} 10, output is "Invalid"