View digital_root.py
def digital_root(n): | |
""" digital_root - recursively figure out the digital root of a number""" | |
s = 0 # s -> running sum | |
while n > 0: | |
# take each digit from the number by running mod 10 (ones position in base 10 number) | |
s += int(n%10) | |
# reduce the number by a factor of 10 to remove the ones position | |
n = int(n/10) | |
if s >= 10: | |
# if the num is greater than or equal to 10 recursively call self |
View main.go
package main | |
import ( | |
"fmt" | |
) | |
func reverseStr(s string) string { | |
input := []byte(s) | |
for i := 0; i < len(input)/2; i++ { | |
input[i], input[(len(input)-1)-i] = input[(len(input)-1)-i], input[i] |
View main.go
package main | |
import ( | |
"fmt" | |
) | |
func reverse(input int) int { | |
var result int | |
for ; input != 0; input = input / 10 { | |
result = input%10 + 10*result |
View main.go
package main | |
import ( | |
"fmt" | |
"os" | |
"os/signal" | |
"syscall" | |
"time" | |
) |
View progress.sh
#!/bin/bash | |
function progress { | |
cattail='=' | |
cat1=' ,------, ' | |
cat2=' | /\_/\ ' | |
cat3=' |__( ^ .^) ' | |
cat4=' "" "" ' | |
echo;echo;echo;echo;echo;echo |
View client_tls_info.go
package main | |
import ( | |
"crypto/tls" | |
"encoding/json" | |
"fmt" | |
"log" | |
"net" | |
"net/http" | |
) |
View nyan.c
#include <stdlib.h> | |
#include <ncurses.h> | |
#include <unistd.h> | |
/* our cat */ | |
const char nyan_cat[4][12] = { | |
",------, \n", | |
"| /\\_/\\\n", | |
"|__( ^ .^) \n", | |
"\"\" \"\" \n"}; |
View validation-main.go
package main | |
import ( | |
"encoding/json" | |
"errors" | |
"net/http" | |
"github.com/asaskevich/govalidator" | |
) |
View main.go
package main | |
import ( | |
"fmt" | |
"net/http" | |
"time" | |
"golang.org/x/net/context" | |
"github.com/husobee/backdrop" |
View main.go
package main | |
import ( | |
"flag" | |
"fmt" | |
"time" | |
"golang.org/x/crypto/bcrypt" | |
) |