Skip to content

Instantly share code, notes, and snippets.

Johannes Pfau jpf91

Block or report user

Report or block jpf91

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:1103866
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);
View gist:1182041
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);
View gist:1184671
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();
View gist:1188128
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();
View gist:1194497
// 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
View gist:1273678
// 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.
View gist:1380063
/* 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
View gist:1380076
/* 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 Dec 25, 2011
libev D example
View gist:1519658
///
module libev;
import deimos.ev;
import std.socket;
import std.typecons;
import std.exception;
import std.stdio;
View gist:1737240
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
You can’t perform that action at this time.