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
def isAuthenticated(User u) { | |
try { | |
return u.impersonate().isAuthenticated() | |
} | |
// Users pulled from SCM history e.a. are not GUI users | |
catch (org.acegisecurity.userdetails.UsernameNotFoundException xc) { | |
return false | |
} | |
} |
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
fn name(line: &str) -> &str { | |
let mut f = line.split("|"); | |
f.next(); | |
f.next(); | |
f.next(); | |
f.next(); | |
f.next(); | |
f.next(); | |
f.next(); | |
let s = f.next().unwrap(); |
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" | |
"flag" | |
"image/color" | |
"io" | |
"log" | |
"os" | |
"strconv" |
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
// This package is Linux only | |
package main | |
import ( | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"strconv" |
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
// Needs to be executed in the root of the Maven project because files are | |
// looked up relative to module directory | |
package main | |
import ( | |
"encoding/xml" | |
"flag" | |
"fmt" | |
"log" |
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" | |
"flag" | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"net/url" |
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 ( | |
"bytes" | |
"fmt" | |
"log" | |
"net/smtp" | |
"os" | |
"os/user" | |
) |
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
// Show average duration of all builds for a given Jenkins freestyle job | |
// return codes: | |
// 1: bad usage | |
package main | |
import ( | |
"encoding/json" | |
"flag" | |
"fmt" |
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 ( | |
"os" | |
"strconv" | |
) | |
func euclid(i, j int) int { | |
for i != j { | |
if i > j { |
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 ( | |
"fmt" | |
"os" | |
"strconv" | |
) | |
func Bmi(m, l float64) int { | |
return int(m/(l*l) + 0.5) |
NewerOlder