This file contains hidden or 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 importpaths | |
| import ( | |
| "log" | |
| "os" | |
| "strconv" | |
| "strings" | |
| "go/ast" | |
| "go/parser" |
This file contains hidden or 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
| // Now available in package form at https://github.com/rjz/githubhook | |
| package handler | |
| // https://developer.github.com/webhooks/ | |
| import ( | |
| "crypto/hmac" | |
| "crypto/sha1" | |
| "encoding/hex" | |
| "errors" |
This file contains hidden or 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
| @ lets try to blink an LED on the discovery stm32 L1 board | |
| @ uses LED on PB7 | |
| @ how to compile and flash: | |
| @ arm-none-eabi-as -mcpu=cortex-m3 blinky.s -o blinky.o | |
| @ arm-none-eabi-ld -v -T stm32.ld -nostartfiles -o blinky.elf blinky.o | |
| @ arm-none-eabi-objcopy -O binary blinky.elf blinky.bin | |
| @ then from st-link (https://github.com/texane/stlink) | |
| @ ./st-flash write ../first_arm/blinky.bin 0x08000000 | |
| .thumb |
This file contains hidden or 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 main | |
| import ( | |
| "bytes" | |
| "encoding/json" | |
| "fmt" | |
| "strconv" | |
| ) | |
| func main() { |
This file contains hidden or 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 ( | |
| "archive/zip" | |
| "io" | |
| "os" | |
| "path/filepath" | |
| "strings" | |
| ) | |
| func zipit(source, target string) error { | |
| zipfile, err := os.Create(target) |
This file contains hidden or 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 | |
| # | |
| # Read-only Root-FS for Raspian | |
| # | |
| # Modified 2015 by Pascal Rosin to work on raspian-ua-netinst with | |
| # overlayfs integrated in Linux Kernel >= 3.18. | |
| # | |
| # Originally written by Axel Heider (Copyright 2012) for Ubuntu 11.10. | |
| # This version can be found here: | |
| # https://help.ubuntu.com/community/aufsRootFileSystemOnUsbFlash#Overlayfs |
This file contains hidden or 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 main | |
| import ( | |
| "log" | |
| "net/http" | |
| "encoding/json" | |
| "golang.org/x/net/websocket" | |
| "fmt" | |
| ) |
This file contains hidden or 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 main | |
| import ( | |
| "fmt" | |
| "io" | |
| "io/ioutil" | |
| "net" | |
| "os" | |
| "strings" |
This file contains hidden or 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 main | |
| import ( | |
| "encoding/xml" | |
| "fmt" | |
| ) | |
| var payload = ` | |
| <ns:workItem> | |
| <typ:correspondenceCount>10</typ:correspondenceCount> |
This file contains hidden or 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
| // a pool embedding the original pool and adding adbno state | |
| type DbnoPool struct { | |
| redis.Pool | |
| dbno int | |
| } | |
| // "overriding" the Get method | |
| func (p *DbnoPool)Get() Connection { | |
| conn := p.Pool.Get() |