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
type TestSetter struct { | |
cmd *redis.StatusCmd | |
} | |
func (t *TestSetter) Set(k string, v interface{}, d time.Duration) *redis.StatusCmd { | |
return t.cmd | |
} | |
// Unit - make it fail | |
func Test_setUser(t *testing.T) { |
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 main | |
import ( | |
"bufio" | |
"bytes" | |
"flag" | |
"io/ioutil" | |
"path/filepath" | |
"testing" | |
) |
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 main | |
import ( | |
"bufio" | |
"bytes" | |
"flag" | |
"io/ioutil" | |
"path/filepath" | |
"testing" | |
) |
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 main | |
import ( | |
"bufio" | |
"bytes" | |
"io/ioutil" | |
"path/filepath" | |
"testing" | |
) |
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 main | |
import ( | |
"bufio" | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"io" | |
"os" | |
) |
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 (p *PerceptorService) Run() { | |
for { | |
conn, _, err := d.Dial(host, headers) | |
if err != nil { | |
fmt.Printf("WS Connection Failure: %s", err) | |
time.Sleep(time.Second) | |
continue | |
} | |
ReadLoop: | |
for { |
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 (s *subscription) consume() { | |
for { | |
client := s.client | |
// Connect to Redis Pubsub Channel | |
pubsub := client.PubSub() | |
err := pubsub.Subscribe(s.channel) | |
// On error sleep for 1 second, log and continue to the next loop iteration | |
if err != nil { | |
log.Errorf("Redis Connection Error: %s", err) | |
time.Sleep(time.Second) |
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
#!pydsl|stateconf -ps | |
include('apt-transport-https', 'python-software-properties') | |
lxc_docker = state('.lxc-docker') | |
lxc_docker.pkgrepo.managed( | |
name='deb https://get.docker.io/ubuntu docker main', | |
keyserver='hkp://keyserver.ubuntu.com:80', | |
keyid='36A1D7869245C8950F966E92D8576A8BA88D21E9') | |
lxc_docker.pkg.installed('lxc-docker') \ |
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
#!pydsl|stateconf -ps | |
state('.repo') \ | |
.git.latest( | |
name='https://github.com/itagenten/tree', | |
rev='json', | |
target='/tmp/tree') | |
state('.make') \ | |
.cmd.wait( |
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
snippet #! "Shebang header for python scripts" b | |
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
$1 | |
`!p snip.rv = ''.join(['=' for i in range(0, len(t[1]))])` | |
$2 | |
""" |
NewerOlder