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
| /* | |
| glog-example | |
| ------------ | |
| background | |
| --- | |
| You probably want to read the source code comments at the top of the glog.go file in | |
| the golang/glog repository on github.com. Located here: https://github.com/golang/glog/blob/master/glog.go | |
| setup |
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/gob" | |
| "io/ioutil" | |
| "log" | |
| "os" | |
| "time" |
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
| # | |
| # PREDICTING LONG TERM CUSTOMER VALUE WITH BTYD PACKAGE | |
| # Pareto/NBD (negative binomial distribution) modeling of | |
| # repeat-buying behavior in a noncontractual setting | |
| # | |
| # Matthew Baggott, matt@baggott.net | |
| # | |
| # Accompanying slides at: | |
| # http://www.slideshare.net/mattbagg/baggott-predict-customerinrpart1# | |
| # |
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" | |
| "math" | |
| ) | |
| type VM struct { | |
| Floats [1 << 8]float64 | |
| Code []Instr |
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/python | |
| # -*- coding: utf-8 -*- | |
| '''Task | |
| https://www.hackerrank.com/challenges/30-bitwise-and | |
| Given set S={1,2,3,…,N}S={1,2,3,…,N}. Find two integers, AA and BB (where A<BA<B), from set SS such that the value of A&BA&B is | |
| the maximum possible and also less than a given integer, KK. In this case, && represents the bitwise AND operator. | |
| Input Format |
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" | |
| "unicode" | |
| "unicode/utf8" | |
| ) | |
| func isCombo(r rune) bool { | |
| return unicode.Is(unicode.Mn, r) || unicode.Is(unicode.Me, r) || unicode.Is(unicode.Mc, r) |
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
| var myV = flag.Int("myV", 23, "test") | |
| func TestFlag(t *testing.T) { | |
| flag.Lookup("v").Value.Set(fmt.Sprint(*myV)) | |
| println(*v, *myV) | |
| } | |
| // or | |
| func init() { | |
| if testing.Verbose() { |
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
| // Copyright 2016 Google Inc. All rights reserved. | |
| // Use of this source code is governed by the Apache 2.0 | |
| // license that can be found in the LICENSE file. | |
| // Command caption reads an audio file and outputs the transcript for it. | |
| package main | |
| import ( | |
| "fmt" | |
| "io" |
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 python | |
| """ | |
| Copyright 2011 Domen Kozar. All rights reserved. | |
| Redistribution and use in source and binary forms, with or without modification, are | |
| permitted provided that the following conditions are met: | |
| 1. Redistributions of source code must retain the above copyright notice, this list of | |
| conditions and the following disclaimer. |
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/bash +x | |
| while [ "true" ] | |
| do | |
| VPNCON=$(nmcli con status | grep *MyVPNConnectionName* | cut -f1 -d " ") | |
| if [[ $VPNCON != "*MyVPNConnectionName*" ]]; then | |
| echo "Disconnected, trying to reconnect..." | |
| (sleep 1s && nmcli con up uuid df648abc-d8f7-4ce4-bdd6-3e12cdf0f494) | |
| else | |
| echo "Already connected !" | |
| fi |