Skip to content

Instantly share code, notes, and snippets.

This file has been truncated, but you can view the full file.
(function(){
/*!*************************************************************
*
* Firebug Lite 1.4.0a1
*
* Copyright (c) 2007, Parakey Inc.
* Released under BSD license.
* More information: http://getfirebug.com/firebuglite
*
../osdep/win32-console-wrapper.c:22:6: warning: no previous prototype for 'cr_perror' [-Wmissing-prototypes]
void cr_perror(const wchar_t *prefix)
^~~~~~~~~
../osdep/win32-console-wrapper.c:37:5: warning: no previous prototype for 'cr_runproc' [-Wmissing-prototypes]
int cr_runproc(wchar_t *name, wchar_t *cmdline)
^~~~~~~~~~
../osdep/win32-console-wrapper.c:73:5: warning: no previous prototype for 'wmain' [-Wmissing-prototypes]
int wmain(int argc, wchar_t **argv, wchar_t **envp)
^~~~~
@chowey
chowey / readme.md
Last active September 6, 2018 00:43
Bidirectional stream copy

This implementation of bidirectional stream copy has the right behavior for closing streams. The first stream to return io.EOF as a reader triggers a close on the second stream, and then the bidirectional copy may be considered done. The close on the second stream should trigger an error (e.g. io.EOF) on the read of the first stream, closing that stream too.

@chowey
chowey / multilock.go
Last active June 14, 2018 04:33
Pattern for allowing controlled concurrency.
package multilock
import (
"context"
)
// Resource represents a pool that, when drained, locks until a corresponding
// unlock is called.
type Resource struct {
c chan struct{}
@chowey
chowey / channelreader.go
Created June 8, 2017 02:23
Like io.MultiReader, but using a channel (unknown number of input readers)
package main
import "io"
type channelReader struct {
c chan []byte
b []byte
}
func NewChannelReader(c chan []byte) io.Reader {
@chowey
chowey / main.cpp
Last active October 17, 2016 06:13
C++ Win32 Shutdown With Privilages
#include <Windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
HANDLE hToken;
OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES |
TOKEN_QUERY,
&hToken);
package main
import "sync"
type ExitGroup struct {
wg sync.WaitGroup
cl []func()
lk sync.Mutex
}
@chowey
chowey / dllmain.cpp
Created November 27, 2014 18:25
Volume monitoring and control DLL
// dllmain.cpp : Defines the entry point for the DLL application.
#include "volumemonitor.h"
// We use a worker thread for all COM calls, since CoInitialize is not
// otherwise safe to execute in a DLL.
HANDLE worker_thread_;
// There is one global VolumeMonitor that is lazy-loaded. This helps us
// report errors on initialization, and will also re-attempt initialization
// at the next call.
@chowey
chowey / JadeAttrsBench.js
Created May 21, 2012 01:19 — forked from saabi/JadeTmpltBench.js
Simple optimization of Jade attrs
self =
{
header: "Header",
header2: "Header2",
header3: "Header3",
header4: "Header4",
header5: "Header5",
header6: "Header6",
list: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
};
@chowey
chowey / jade.js
Created April 25, 2012 00:44
Testing jade
/*!
* Jade
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
/**
* Module dependencies.
*/