Skip to content

Instantly share code, notes, and snippets.

View kahunacohen's full-sized avatar

Aaron Cohen kahunacohen

View GitHub Profile
@kahunacohen
kahunacohen / .bashrc
Last active August 1, 2023 06:56
matav .bash_profile
# General
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export PATH=$PATH:$HOME/bin
# git
alias gd="git diff"
alias gs='git status'
alias gp='git push'
alias latest_tag='git tag | sort -V | tail -n1'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
response, err := http.Get("https://example.com")
package main
import "fmt"
func fac(n int) int {
ret := 1
for i := n; i > 1; i-- {
ret *= i
}
return ret
package main
import (
"fmt"
"sort"
)
type AgeFactor []Person
func (a AgeFactor) Len() int { return len(a) }
package main
import (
"fmt"
"regexp"
"strings"
)
func reverseString(s string) string {
runes := []rune(s)
package main
import (
"fmt"
"sort"
)
// Implementation of sum of three ints. Do any three ints
// in the given slice sum up to the target?
// Interate through eacn int. For each iteration set low and
package main
import (
"fmt"
"sort"
)
// Implementation of sum of two ints. Do any two ints
// in the given slice sum up to the target? Leverages
// sorting O(n logn) and two pointers. If the sum of the
package main
import "fmt"
// A recursive palindrome function. The terminal cases
// are:
// A. when a string is less than or equal to 1 (a 1 length string is by
// definition a palindrome).
// B. when the first and last characters of a string don't match, we know
// the whole string is not a palindrome.
package main
func isPalindrome(inputString string) bool {
// Initialize two pointers, one at the beginning of the string,
// the second at the end.
// Traverse the string from each direction and check if each
// pair is identical.
// If not return False. If we reach the middle return true.
leftIndx := 0
rightIndx := len(inputString) - 1
package main
import "fmt"
func main() {
nums := make([]int, 100)
for n := range nums {
o := n + 1
if o%15 == 0 {
fmt.Println("fizz buzz")