Skip to content

Instantly share code, notes, and snippets.

View xeoncross's full-sized avatar

David Pennington xeoncross

View GitHub Profile
@kvnxiao
kvnxiao / awesome-go-sorted-by-stars-2019-12-30.md
Last active March 17, 2024 04:05
awesome-go-sorted-by-stars-2019-12-30.md

Awesome Go

Build Status Awesome Slack Widget Netlify Status

patreon avelino financial support to Awesome Go

A curated list of awesome Go frameworks, libraries and software. Inspired by awesome-python.

Contributing

@yoya3312
yoya3312 / youtube.py
Created January 10, 2019 17:25
streamlink with youtube
import re
from streamlink.compat import urlparse, parse_qsl
from streamlink.plugin import Plugin, PluginError
from streamlink.plugin.api import http, validate
from streamlink.plugin.api.utils import parse_query
from streamlink.stream import HTTPStream, HLSStream
from streamlink.stream.ffmpegmux import MuxedStream
import json
import { useState } from 'react';
// Usage
function App() {
// Similar to useState but first arg is key to the value in local storage.
const [name, setName] = useLocalStorage('name', 'Bob');
return (
<div>
<input
@kwilczynski
kwilczynski / dynamodb-setup.sh
Last active January 14, 2024 15:22
Quickly automatically associate Elastic IP address with the current EC2 instance written in Go.
aws dynamodb create-table --region <REGION> --profile <PROFILE> --table-name "<TABLE>" --attribute-definitions "AttributeName=key,AttributeType=S" --key-schema "AttributeName=key,KeyType=HASH" --billing-mode "PAY_PER_REQUEST"
aws dynamodb create-table --region <REGION> --profile <PROFILE> --table-name "<TABLE>" --attribute-definitions "AttributeName=key,AttributeType=S" --key-schema "AttributeName=key,KeyType=HASH" --billing-mode "PROVISIONED" --provisioned-throughput "ReadCapacityUnits=1,WriteCapacityUnits=1"
aws dynamodb update-time-to-live --region <REGION> --profile <PROFILE> --table-name "<TABLE>" --time-to-live-specification "Enabled=true,AttributeName=ttl"
aws dynamodb scan --region <REGION> --profile <PROFILE> --table-name "<TABLE>"
@xeoncross
xeoncross / sortByteSlice.go
Created September 5, 2018 17:11 — forked from schmohlio/sortByteSlice.go
sort byte slices in Golang without needing to fmt as string. useful for Set hashes
package main
import (
"bytes"
"log"
"sort"
)
// implement `Interface` in sort package.
type sortByteArrays [][]byte
@miekg
miekg / learninggo-2.txt
Created August 27, 2018 08:32
Learning Go in RFC 7749 format
Go Working Group R. Gieben
Internet-Draft August 25, 2018
Intended status: Informational
Expires: February 26, 2019
@cdock1029
cdock1029 / FirebaseAuth.tsx
Created June 7, 2018 22:57
react components to handle firebase auth
import { app, User } from 'firebase/app'
import React from 'react'
interface AuthContext {
hasLoaded: boolean
user: User | null
claims?: any
logOut?: () => Promise<any>
logIn?: (email: string, password: string) => void
error?: string
@xeoncross
xeoncross / futch.js
Created May 9, 2018 21:23
HTML5 / Node V8 `fetch()` does not support progress events so you have to use the XHR / XMLHttpRequest object. Here is a simple ES6 + promises wrapper by @caub
// https://github.com/github/fetch/issues/89#issuecomment-256610849
function futch(url, opts={}, onProgress) {
return new Promise( (res, rej)=>{
var xhr = new XMLHttpRequest();
xhr.open(opts.method || 'get', url);
for (var k in opts.headers||{})
xhr.setRequestHeader(k, opts.headers[k]);
xhr.onload = e => res(e.target.responseText);
xhr.onerror = rej;
if (xhr.upload && onProgress)
@manigandand
manigandand / list_directory.go
Last active August 6, 2021 18:22
List files in a directory using golang
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
)
@gadelkareem
gadelkareem / FileCache.go
Created March 2, 2018 04:46
Simple Golang file cache
package utilities
import (
"path/filepath"
"os"
"sync"
"io/ioutil"
"time"
"github.com/vmihailenco/msgpack"
)