This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define("UPLOAD_DIR", "/tmp/pobox-uploads/"); | |
define("CODE", "secretcodehere"); | |
if ($_SERVER['REQUEST_METHOD'] == "POST") { | |
if ($_POST["code"] !== CODE) { | |
die("upload denied: illegal code"); | |
} | |
if (!(is_dir(UPLOAD_DIR) || mkdir(UPLOAD_DIR, 0700))) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
// appended odd string to avoid shadowing existing vars | |
function chatroomwidget_88ed71a($) { | |
if ($ === undefined) { | |
throw "chatroomwidget.js requires jQuery"; | |
} | |
// TODO: get from query string | |
if (chatroomwidgetServerUrl === undefined) { | |
throw "chatroomwidgetServerUrl must be defined"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright © 2014 Hraban Luyat <hraban@0brg.net> | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to | |
// deal in the Software without restriction, including without limitation the | |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
// sell copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.io | |
import scala.util.Random | |
object RandomQuote { | |
private def splitParagraphs(r: io.BufferedSource) = | |
r.mkString.split("\n\n") | |
private def getRandomElement[T](ar: Array[T]): Option[T] = ar.length match { | |
case 0 => None | |
case _ => Some(ar(Random.nextInt(ar.length))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Memcpy demonstration. Try compiling with: | |
* | |
* $ gcc -Wall -Werror -pedantic -std=c99 -S test.c -o test-deref.s | |
* $ gcc -Wall -Werror -pedantic -std=c99 -S test.c -DMEMCPY -o test-memcpy.s | |
* $ diff -u test-deref.s test-memcpy.s | |
* | |
* And play with -O0 to -O3 flags to see the effect of optimizations. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# Attempt to guess a canonical system name. | |
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, | |
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, | |
# 2011, 2012 Free Software Foundation, Inc. | |
timestamp='2012-02-10' | |
# This file is free software; you can redistribute it and/or modify it | |
# under the terms of the GNU General Public License as published by |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<link rel=icon id=favicon > | |
<script> | |
var i = 0; | |
setInterval(function () { | |
i=(i+1)%4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright (c) Hraban Luyat 2015 <hraban@0brg.net> | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU Affero General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro make-coroutine ((&key (coroutine-done-value :done)) &body body) | |
(alexandria:with-gensyms ((thrfn "thread body") | |
(c "channel")) | |
`(let* ((,c (make-instance 'chanl:bounded-channel)) | |
(,thrfn (lambda () | |
(flet ((yield (&optional n) | |
(chanl:send ,c n))) | |
,@body | |
(yield ,coroutine-done-value))))) | |
(let ((alive-p T) val thr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
namespace Locking | |
{ | |
internal interface IWaitableLock | |
{ | |
/// <summary> | |
/// Acquire the lock. | |
/// </summary> |
OlderNewer