Skip to content

Instantly share code, notes, and snippets.

@loosechainsaw
loosechainsaw / Dockerfile
Created October 28, 2019 07:18
NVIDIA Cuda Dev Env
FROM nvidia/cuda:10.1-devel-ubuntu18.04
RUN echo "Setting Environment..."
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES all
ARG USER
RUN echo "Updating Package Index and Upgrading..."
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
@loosechainsaw
loosechainsaw / .Xresources
Created August 19, 2018 14:07
Rxvt settings
!-------------------------------------------------------------------------------
! Xft settings
!-------------------------------------------------------------------------------
Xft.dpi: 96
Xft.antialias: false
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
#include <iostream>
#include <vector>
using namespace std;
template<typename T, size_t N>
class MemoryPool{
struct node{
node* next;
};
#include <iostream>
using namespace std;
namespace search {
namespace algorithms {
long boyer_moore(std::string const &text, std::string const &pattern) {
auto m = pattern.size();
auto n = text.size();
@loosechainsaw
loosechainsaw / cb.cs
Created May 12, 2015 14:36
Circuit Breaker
internal class ScopedAquiredWriteLock : IDisposable
{
internal ScopedAquiredWriteLock(ReaderWriterLockSlim locker)
{
this.locker = locker;
this.locker.EnterWriteLock();
}
public void Dispose()
public class State<TS,TR>
{
public State(Func<TS, Tuple<TS, TR>> f){
Run = f;
}
public State<TS,TN> Map<TN>(Func<TR,TN> f){
return new State<TS,TN>( x => {
var t = Run(x);
return Tuple.Create(t.Item1, f(t.Item2));
@loosechainsaw
loosechainsaw / remoteactors.cs
Created February 16, 2015 04:56
Remote Actors Sample
using System;
using System.Threading;
using Akka;
using Akka.Actor;
namespace AkkaRemoting
{
public class RequestMessage
{
akka {
log-config-on-start = off
stdout-loglevel = INFO
loglevel = ERROR
actor {
provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
debug {
receive = on
autoreceive = on
lifecycle = on
@loosechainsaw
loosechainsaw / akkascattergather.cs
Created February 9, 2015 13:30
Example of Scatter Gather in Akka.NET
using System;
using Akka.Actor;
using Akka;
using Akka.Remote;
using Akka.Routing;
using System.Linq;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;