Skip to content

Instantly share code, notes, and snippets.

View christiankakesa's full-sized avatar
💭
Building

Christian Kakesa christiankakesa

💭
Building
View GitHub Profile
//...
#if defined(WINXX)
#include <sys/timeb.h>
typedef struct timeval {
__time64_t tv_sec;
long tv_usec;
} timeval;
#else
#include <sys/time.h>
#endif //defined(WINXX)
@christiankakesa
christiankakesa / exemple.cc
Created January 10, 2011 23:16
Singleton template
// Singleton threadsafe sample
// by Christian Kakesa <[email protected]>
// (c) 2011
#include "exemple.h"
int Exemple::get_number() const
{
return number_;
}
@christiankakesa
christiankakesa / netssh_3_commands.rb
Last active November 17, 2016 10:29
Ruby Net-SSH tests (net-ssh '>= 2.9.2')
require 'logger'
require 'net/ssh'
require 'stud/interval'
@log = Logger.new(STDOUT).tap { STDOUT.sync = true }
@ssh_session = Net::SSH.start('localhost', 'christian', password: 'xxx')
@interruptible = false
trap('SIGINT') { @interruptible = true }
@christiankakesa
christiankakesa / erubi_deck.rb
Last active March 12, 2017 22:18
Erubi template engine test
# frozen_string_literal: true
require 'erubi'
require 'shield'
class ErubiDeck < Syro::Deck
include Shield::Helpers
LAYOUT = 'layout'
VIEW = 'views/%s.erb'
DEFAULT_OPTIONS = {
@christiankakesa
christiankakesa / faktory-build_ubuntu-16.04.sh
Created November 24, 2017 21:16
If you want to play with Faktory on Ubuntu 16.04, this bash script could help you.
#!/bin/sh
#
# Faktory build on Ubuntu 16.04
#
# Christian Kakesa <[email protected]>
# 2017-11-23
set -eu
BASEDIR=${HOME}/src/faktory
@christiankakesa
christiankakesa / ticker_simple.cr
Created October 24, 2018 02:52
Example of simple ticker
struct Ticker
getter tick
@tick = Channel(Bool).new
def initialize(tick_s : Int32)
spawn do
loop do
sleep tick_s
@tick.send true
end
@christiankakesa
christiankakesa / ticker_complete.cr
Last active March 18, 2019 00:45
Example of complete ticker
struct Ticker
getter tick, done
@tick = Channel(Bool).new
@done = Channel(Bool).new
def initialize(tick_s : Int32)
spawn do
loop do
sleep tick_s
@tick.send true
@christiankakesa
christiankakesa / avalanchego.service
Last active September 25, 2021 21:45
SystemD file for Avalanche node
[Unit]
Description=AvalancheGo
Wants=network-online.target
After=network.target network-online.target
[Service]
User=ubuntu
Group=ubuntu
WorkingDirectory=/home/ubuntu/go/src/github.com/ava-labs/avalanchego
ExecStart=/home/ubuntu/go/src/github.com/ava-labs/avalanchego/build/avalanchego