Skip to content

Instantly share code, notes, and snippets.

/*
* Excessively long hostname lookup on Mac OS X Snow Leopard
*
* gcc -g -Wall -o gho gho.c
* ./gho 69982
*
* Feb 15 12:42:47 ack mDNSResponder[18]: 77: ERROR: read_msg - hdr.datalen 70001 (11171) > 70000
* Feb 15 12:42:47 ack ./gho[4852]: dnssd_clientstub write_all(4) failed -1/70028 32 Broken pipe
* Feb 15 12:42:47 ack ./gho[4852]: dnssd_clientstub deliver_request ERROR: write_all(4, 70028 bytes) failed
* Feb 15 12:42:47 ack ./gho[4852]: dnssd_clientstub write_all(4) failed -1/28 32 Broken pipe
%%% Crash compiling regexp on Mac OS X
%%%
%%% bin/cerl -smp -debug -smp
%%%
%%% 1> N = 612, re:compile([lists:duplicate(N, $(), lists:duplicate(N, $))]).
%%%
%%% Program received signal EXC_BAD_ACCESS, Could not access memory.
%%% Reason: KERN_PROTECTION_FAILURE at address: 0xb01d0ffc
%%% [Switching to process 7206]
%%% 0x001c04e4 in compile_branch (optionsptr=0x0, codeptr=0x0, ptrptr=0x0, errorcodeptr=0x0, firstbyteptr=0x0, reqbyteptr=0x0, bcptr=0x0, cd=0x0\
%%% Cause epmd to use 100% CPU
%%%
%%% ulimit -n 16
%%% epmd -d -p 1234
%%%
%%% $ erl
%%% emfile:start(1234,32).
%%%
-module(emfile).
-compile(export_all).
#define DEBUG 0
#define FPIN 8 // first Pin
#define LPIN 13 // last Pin
void setup() {
int i = 0;
Serial.begin(9600);
for (i = FPIN; i <= LPIN; i++)
int LDR = 2;
int val = 0;
int inb = 0;
void setup() {
Serial.begin(9600);
pinMode(LDR, INPUT);
}
void loop() {
-module(health).
-behaviour(gen_server).
-export([start_link/0,
check/0, alert/0, dump/0,
threshold/1, poll/1, url/1
]).
-export([init/1, handle_call/3]).
-module(sensor).
-include("light.hrl").
-export([start/0,stop/0]).
% web interface
-export([graph/3]).
start() ->
-module(light).
-export([start/0,start/1]).
-define(TABLE, sensor).
-define(STORE, "db/sensor.db").
-define(TTY, "/dev/ttyUSB0").
-define(LDR, $1).
-define(INTRVL, 1000).
%% Copyright (c) 2010, Michael Santos <[email protected]>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions
%% are met:
%%
%% Redistributions of source code must retain the above copyright
%% notice, this list of conditions and the following disclaimer.
%%
%% Copyright (c) 2010, Michael Santos <[email protected]>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions
%% are met:
%%
%% Redistributions of source code must retain the above copyright
%% notice, this list of conditions and the following disclaimer.
%%