Skip to content

Instantly share code, notes, and snippets.

View jabgibson's full-sized avatar
💭
living

Brandon Gibson jabgibson

💭
living
View GitHub Profile
use std::env;
use std::fs;
use std::process;
fn main() {
let creds_file = match env::var("AWS_CREDS_FILE") {
Ok(val) => val,
Err(_) => {
println!("an env variable of AWS_CREDS_FIlE is required");
process::exit(1);
package main
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"os"
)
func main() {
@jabgibson
jabgibson / play.hs
Created July 7, 2018 05:59
Playing Haskell
-- firsthalf returns True if value is found in the first half of list ls
firsthalf value ls = elem val (reverse (drop (quot (length ls) 2) (reverse ls)))
-- subsek returns a subsection of list ls from start to end
subsek start end ls = drop start (reverse (drop (length ls - end) (reverse ls)))
@jabgibson
jabgibson / guess.hs
Last active July 27, 2018 20:27
Guess Number Game [Multi Language Exercise.. not about line count]
-- this Haskell version is not quite the same as the Nim and Racket versions since I am pulling in a Random
-- number to be guessed, rather than hardcoding the number as seen on Nim and Racket versions on line 3. I am also
-- adding comments to the functions in this Haskell version. This might prompt me to go through and revamp other
-- solutions in the future.
import System.Random
import System.Environment
import Text.Regex
import Text.Regex.Base
@jabgibson
jabgibson / start.sh
Last active February 19, 2018 07:13
Startup script
#!/bin/sh
# Something here
date >> /var/log/boot-timestamps
echo "hello world" >> /home/root/hello-world.txt
package main
import (
// "encoding/json"
"fmt"
"github.com/gorilla/mux"
"io/ioutil"
"net/http"
// "strings"
"strings"
@jabgibson
jabgibson / main.go
Last active August 29, 2015 14:26
Google api token checker
package main
import (
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"io/ioutil"
"net/http"
"strings"
)
@jabgibson
jabgibson / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console