Skip to content

Instantly share code, notes, and snippets.

View PaluMacil's full-sized avatar

Dan Wolf PaluMacil

View GitHub Profile
@PaluMacil
PaluMacil / url-hash-play.html
Created June 7, 2016 20:41
Url hash parsing demo with no JQuery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Url Hash Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="main.js">
document.addEventListener('DOMContentLoaded', function(){
@PaluMacil
PaluMacil / vineScrape.go
Created August 26, 2016 15:02 — forked from cryptix/vineScrape.go
extract a javascript object value from a html page using goquery and otto
package main
import (
"errors"
"log"
"os"
"github.com/PuerkitoBio/goquery"
"github.com/robertkrimen/otto"
)
@PaluMacil
PaluMacil / bs-hidey-example.html
Created September 23, 2016 13:33
Hide text when small
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hidey Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
@PaluMacil
PaluMacil / array-in-get.js
Created September 27, 2016 15:06
This is how JQuery passes an array in a GET request.
//This is how JQuery passes arrays in a GET request
var tdata = { one: 1, two: 2, three: ["a", "b", "c"]};
$.get("/test", tdata, function (data) { console.log("All done!"); });
//http://example.com/test?one=1&two=2&three%5B%5D=a&three%5B%5D=b&three%5B%5D=c
/*Broken down...
http://
example.com/
@PaluMacil
PaluMacil / nuhatch_uuid.go
Created September 28, 2016 23:38
Simple playing with Nuhach's uuid.
package main
import (
"encoding/base64"
"fmt"
uuid "github.com/nu7hatch/gouuid" // It seems that github.com/satori/go.uuid has more advanced functionality.
)
func main() {
@PaluMacil
PaluMacil / quoted-parse.go
Created October 6, 2016 03:52
parse args from a string by splitting on spaces, leaving quoted strings together as one arg
package main
import (
"fmt"
)
func parse(line string) ([]string, error) {
args := []string{}
quoted := false
@PaluMacil
PaluMacil / Go no cache headers.go
Created April 30, 2017 00:41
http/net Go no cache headers
package main
import (
"encoding/json"
"fmt"
"net/http"
)
type healthModel struct {
Message string `json:"message"`
@PaluMacil
PaluMacil / Dockerfile
Created August 9, 2017 21:24
Multi-stage Dockerfile for building a ~10 MB Go container
FROM golang:1.8.3 as goget
LABEL maintainer="dcwolf@gmail.com"
ADD ./main.go /go/src/github.com/palumacil/example/main.go
ADD ./handler.go /go/src/github.com/palumacil/example/handler.go
ADD ./config.go /go/src/github.com/palumacil/example/config.go
RUN go get .\..
FROM golang:1.8.3-alpine as gobuild
LABEL maintainer="dcwolf@gmail.com"
COPY --from=goget /go/src /go/src
package main
import (
"fmt"
"math"
)
type AttributeValue struct {
Entropy float64
PofValue float64
@PaluMacil
PaluMacil / round.c
Created November 26, 2020 16:48
"round" is an OpenMPI ring ping to demonstrate a message getting passed between each node and modified one at a time
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <mpi.h>
#define MASTER 0
#define TAG 0
#define MSGSIZE 100000
#define MAX 25