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
| short passcode(const char *callsign) { | |
| uint8_t i, len; | |
| short hash = KEY; | |
| char no_ssid[10], *p1 = no_ssid, *ptr = no_ssid; | |
| // remove SSID | |
| while((*callsign != '-') && (*callsign != '\0')) *p1++ = toupper((int) (*callsign++)); | |
| *p1 = '\0'; | |
| i = 0; |
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
| SELECT | |
| a.attname AS field, | |
| t.typname AS type, | |
| format_type(a.atttypid, a.atttypmod) AS complete_type, | |
| a.attnotnull AS isnotnull, | |
| (SELECT 't' | |
| FROM pg_index | |
| WHERE c.oid = pg_index.indrelid | |
| AND a.attnum = ANY (pg_index.indkey) | |
| AND pg_index.indisprimary = 't' |
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
| # very rough php 5.4->5.5 upgrade guide | |
| # your environment may differ slightly, just let me know and I'll help out where I can. | |
| # go to http://www.dotdeb.org/instructions/ and add the wheezy php 5.5 repositories under | |
| # section 2 to /etc/apt/sources.list | |
| # | |
| # It's safe to leave the default dotdeb entries if you want. | |
| # method 1 (preferred, easiest) | |
| # upgrade all packages |
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
| <?php | |
| /* | |
| * $handler = new \Session(); | |
| * session_set_save_handler($handler, true); | |
| * session_start(); | |
| */ | |
| use \SparkLib\Fail; | |
| class Session extends SessionHandler { | |
| public function __construct() { |
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" | |
| "sync" | |
| "time" | |
| ) | |
| func main() { | |
| const n = 100 |
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
| begin | |
| node_storage = data_bag_item('nodes', node.name) | |
| requested_revision = node_storage['deployments'].last['revision'] | |
| rescue Net::HTTPServerException | |
| # data bag item does not exist, create it | |
| new_node = { | |
| 'id' => node.name, | |
| 'deployments' => [{ | |
| 'date' => Time.now, | |
| 'revision' => 'HEAD', |
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
| f, err := os.OpenFile("testlogfile", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) | |
| if err != nil { | |
| log.Fatalf("error opening file: %v", err) | |
| } | |
| defer f.Close() | |
| log.SetOutput(f) | |
| log.Println(string(body)) |
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
| // determines whether a string represents json data | |
| func isJSON(s string) bool { | |
| var js map[string]interface{} | |
| return json.Unmarshal([]byte(s), &js) == nil | |
| } |
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
| func randomMAC() string { | |
| macBuf := make([]byte, 3) | |
| if _, err := rand.Read(macBuf); err != nil { | |
| panic(err) | |
| } | |
| return fmt.Sprintf("aa:bb:cc:%02x:%02x:%02x", macBuf[0], macBuf[1], macBuf[2]) | |
| } |
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
| #!/usr/bin/env ruby | |
| # check-smtp | |
| # === | |
| # | |
| # This is a simple SMTP check script for Sensu | |
| # | |
| require 'rubygems' if RUBY_VERSION < '1.9.0' | |
| require 'net/smtp' | |
| require 'sensu-plugin/check/cli' |