Skip to content

Instantly share code, notes, and snippets.

Avatar

David Pennington Xeoncross

View GitHub Profile
@Xeoncross
Xeoncross / YouTubeURLFormats.txt
Created Jan 16, 2021 — forked from rodrigoborgesdeoliveira/YouTubeURLFormats.txt
Example of the various YouTube url formats
View YouTubeURLFormats.txt
http://www.youtube.com/watch?v=-wtIMTCHWuI
http://www.youtube.com/v/-wtIMTCHWuI?version=3&autohide=1
http://youtu.be/-wtIMTCHWuI
http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D-wtIMTCHWuI&format=json
http://www.youtube.com/attribution_link?a=JdfC0C9V6ZI&u=%2Fwatch%3Fv%3DEhxJLojIE_o%26feature%3Dshare
@Xeoncross
Xeoncross / static_server.go
Last active Jan 1, 2021
Example of using httprouter or gorilla/mux to serve static assets (JS, Images, CSS, etc..) cached in the app binary using github.com/markbates/pkger
View static_server.go
// https://github.com/julienschmidt/httprouter
router := httprouter.New()
router.HandlerFunc("GET", "/", index())
router.Handler("GET", "/static/*filepath", http.StripPrefix("/static/", http.FileServer(pkger.Dir("/public/static"))))
// https://github.com/gorilla/mux
router := mux.NewRouter()
router.HandleFunc("/", index())
router.PathPrefix("/static").Handler(http.StripPrefix("/static/", http.FileServer(pkger.Dir("/public/static"))))
@Xeoncross
Xeoncross / remove_ubuntu.sh
Created Nov 7, 2020
Remove Ubuntu, Debian, Android, etc... from windows computer
View remove_ubuntu.sh
# You can do this using cmd run as administrator from the desktop
# (or if using a Windows 10 S-Mode computer from the startup repair or a USB drive).
$ diskpart
> list vol
# Find the Fat32, 100MB/260MB EFI volume and select it:
> select volume 3
> assign letter=z
> exit
@Xeoncross
Xeoncross / aes.go
Created Oct 16, 2020 — forked from tscholl2/aes.go
simple AES encryption/decryption example with PBKDF2 key derivation in Go, Javascript, and Python
View aes.go
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"crypto/sha256"
"encoding/hex"
"fmt"
"strings"
@Xeoncross
Xeoncross / crypto-sha.js
Created Aug 19, 2020 — forked from chrisveness/crypto-sha.js
Uses the SubtleCrypto interface of the Web Cryptography API to hash a message using SHA-256.
View crypto-sha.js
/**
* Returns SHA-256 hash from supplied message.
*
* @param {String} message.
* @returns {String} hash as hex string.
*
* @example
* sha256('abc').then(hash => console.log(hash));
* const hash = await sha256('abc');
*/
View gist:cdb501a44eacda865b00b4806dcb318a
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
)
// https://pkg.go.dev/go/ast?tab=doc#Object.Type
@Xeoncross
Xeoncross / 64bit_hash_collisions_test.go
Last active Jun 3, 2020
Tests to see how 64bit hash functions perform in Go.
View 64bit_hash_collisions_test.go
package main
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"hash/fnv"
"testing"
"time"
@Xeoncross
Xeoncross / LSA.py
Created May 22, 2020 — forked from vgoklani/LSA.py
Latent Semantic Analysis (LSA) [simple example]
View LSA.py
#!/usr/bin/python
# reference => http://www.puffinwarellc.com/index.php/news-and-articles/articles/33.html
from numpy import zeros
from scipy.linalg import svd
from math import log # needed for TFIDF
from numpy import asarray, sum
titles = ["The Neatest Little Guide to Stock Market Investing",
@Xeoncross
Xeoncross / crypto_news.json
Created May 22, 2020 — forked from stungeye/crypto_news.json
News Site RSS Feeds
View crypto_news.json
[
{
"url": "http://money.cnn.com",
"rss": "http://rss.cnn.com/rss/money_topstories.rss"
},
{
"url": "http://thehill.com",
"rss": "http://thehill.com/rss/syndicator/19110"
},
{
@Xeoncross
Xeoncross / mysql.py
Last active May 7, 2020
Example database class for wrapping mysql-connector for python
View mysql.py
import mysql.connector
# from mysql.connector import Error
# pip3 install mysql-connector
# https://dev.mysql.com/doc/connector-python/en/connector-python-reference.html
class DB():
def __init__(self, config):
self.connection = None
self.connection = mysql.connector.connect(**config)