Skip to content

Instantly share code, notes, and snippets.

Avatar

David Pennington Xeoncross

View GitHub Profile
@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)
@Xeoncross
Xeoncross / docker_environment.md
Created Apr 30, 2020
Be careful when setting docker compose environment variables
View docker_environment.md

The following shows the right and wrong way to specify the environment flags. Be careful using Key: Value format depending on the docker version.

version: "3.2"
services:
    mariadb:
        image: mariadb:10.5
        ports:
            - "3306:3306"
        environment:
@Xeoncross
Xeoncross / mysql_bitmap.sql
Created Apr 8, 2020
MySQL / MariaDB bitmap operations on records
View mysql_bitmap.sql
-- https://stackoverflow.com/questions/60645538/how-do-you-store-and-mutate-a-bitmap-bitset-using-mysql
create table test(id int, b blob);
insert into test(id, b) select 1, 0x000000;
insert into test(id, b) select 2, 0xffffff;
delimiter //
create function set_bit(b blob, pos int, val int) returns blob reads sql data
comment 'changes the bit at position <pos> (0: right most bit) to <val> in the blob <b>'
begin
You can’t perform that action at this time.