Skip to content

Instantly share code, notes, and snippets.

detach()
{
if (!RefCounted._store) return;
assert(RefCounted._store._count > 0);
if (--RefCounted._store._count)
{
debug(RefCounted) if (RefCounted.debugging)
writeln(typeof(this).stringof,
"@", cast(void*)RefCounted._store,
": decrement refcount to ", RefCounted._store._count);
import std.socket, std.exception, std.stdio, std.random, std.range;
void main(string args[])
{
enforce(args.length == 2);
if(args[1] == "--server")
{
auto sock = new Socket(AddressFamily.INET, SocketType.STREAM);
sock.bind(new InternetAddress("localhost", 9870));
sock.listen(0);
import std.datetime, std.concurrency, std.stdio, core.sys.posix.unistd;
import std.exception;
enum BUFFER_SIZE = 1 * 1024 * 1024UL;
void main(string[] args)
{
assert(args.length == 4);
ubyte[BUFFER_SIZE] buf;
auto sw = StopWatch();
import std.datetime, std.concurrency, std.stdio, core.sys.posix.unistd;
import std.exception;
enum BUFFER_SIZE = 1 * 1024 * 1024UL;
void main(string[] args)
{
assert(args.length == 3);
auto sw = StopWatch();
// Written in the D programming language.
/**
* Signals and Slots are an implementation of the Observer Pattern.
* Essentially, when a Signal is emitted, a list of connected Observers
* (called slots) are called.
*
* There have been several D implementations of Signals and Slots.
* This version makes use of several new features in D, which make
* using it simpler and less error prone. In particular, it is no
// Copyright Jens K. Mueller
// Boost License 1.0
// easy use by writec* in write fashion
// using the shared terminals
// or using .backgroundColor = Color.black
// What if the user wants to persistently change the terminal settings.
// Is this useful? I think it's not recommended.
/* Copyright (C) 1992, 1995-2002, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
/* Copyright (C) 1992, 1995-2001, 2002, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@jpf91
jpf91 / gist:1519658
Created December 25, 2011 19:45
libev D example
///
module libev;
import deimos.ev;
import std.socket;
import std.typecons;
import std.exception;
import std.stdio;
diff -ur build.old/Makefile.in build/Makefile.in
--- build.old/Makefile.in 2012-02-04 13:49:36.000000000 +0100
+++ build/Makefile.in 2012-02-04 14:46:13.749514106 +0100
@@ -384,7 +384,7 @@
GCC_CONFIG_ARGS=--prefix=$(prefix) \
--target=${cur_target} --host=${cur_host} --build=${cur_build} \
- --with-gnu-as --with-gnu-ld --enable-languages=c,c++
+ --with-gnu-as --with-gnu-ld --enable-languages=c,c++,d