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
id := make(chan string) | |
go func() { | |
h := sha1.New() | |
c := []byte(time.Now().String()) | |
for { | |
h.Write(c) | |
id <- fmt.Sprintf("%x", h.Sum(nil)) | |
} | |
}() |
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
package counter | |
import "io" | |
type Counter struct { | |
w io.Writer | |
c int | |
} | |
func New(w io.Writer) (h *Counter) { |
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
id := make(chan string) | |
count := make(chan int) | |
go func() { | |
h := sha1.New() | |
w := counter.New(h) | |
c := []byte(time.Now().String()) | |
w.Write(c) | |
for { | |
select { |
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; | |
use warnings; | |
use WWW::Mechanize; | |
use DB_File; | |
my %signed; | |
tie %signed, "DB_File", "signed", O_RDWR|O_CREAT, | |
0666, $DB_HASH or die "Failed to open signed\n"; |
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
alt0=0; | |
alt1=0; | |
alt2=0; | |
alt3=0; | |
alt4=0; | |
alt5=0; | |
d=getch(); | |
c=0; | |
if (d!='-') do { | |
alt5=alt4; |
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
var Noduino = new NoduinoObj({debug: true, host: 'http://localhost:8090'}, Connector); | |
Noduino.connect(function(err, board) { | |
if (err) { return console.log(err); } | |
board.withLED({pin: 13}, function(err, LED) { | |
if (err) { return console.log(err); } | |
LED.blink(250); | |
LED.on('on', function() } | |
console.log('LED is on!'); | |
}); |
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
void setup() | |
{ | |
pinMode(13, OUTPUT); | |
} | |
void loop() | |
{ | |
digitalWrite(13, HIGH); | |
delay(250); |
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
func redirect(to string, from *os.File) (err error) { | |
if out, err := os.Create(name); err == nil { | |
err = syscall.Dup2(int(out.Fd()), int(from.Fd())) | |
} else { | |
err = fmt.Errorf("Unable to create file %s", to) | |
} | |
return | |
} |
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
package counter | |
import ( | |
"io" | |
) | |
type Counter struct { | |
w io.Writer // Underlying writer to send data to | |
c int // Number of bytes written since last call to Count() | |
} |
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
(setq last-location-file (concat my-emacs-d "/last-location")) | |
(defun load-last-location-file () | |
(if (file-exists-p last-location-file) | |
(read (with-temp-buffer | |
(insert-file-contents last-location-file) | |
(buffer-string))) | |
(make-hash-table :test 'equal))) | |
(setq last-location-table (load-last-location-file)) |
OlderNewer