Skip to content

Instantly share code, notes, and snippets.

View GramThanos's full-sized avatar
💭
undefined reference to `status'

Grammatopoulos Athanasios Vasileios GramThanos

💭
undefined reference to `status'
View GitHub Profile
(function() {
let colors = ["Red", "Orange", "Yellow", "Green", "Cyan", "Blue", "Magenta", "Purple", "White", "Black", "Grey", "Silver", "Pink", "Maroon", "Brown", "Beige", "Tan", "Peach", "Lime", "Olive", "Turquoise", "Teal", "Indigo", "Violet"];
let animals = ["Alligator", "Armadillo", "Bat", "Bear", "Beaver", "Buffalo", "Cat", "Camel", "Capybara", "Chameleon", "Cheetah", "Chipmunk", "Chupacabra", "Cormorant", "Coyote", "Crow", "Dingo", "Dinosaur", "Dog", "Dolphin", "Duck", "Elephant", "Ferret", "Fox", "Frog", "Giraffe", "Grizzly", "Hedgehog", "Hippo", "Hyena", "Iguana", "Jackal", "Kangaroo", "Koala", "Kraken", "Lemur", "Leopard", "Lion", "Mink", "Monkey", "Moose", "Orangutan", "Otter", "Panda", "Penguin", "Platypus", "Pumpkin", "Python", "Quagga", "Rabbit", "Raccoon", "Rhino", "Sheep", "Shrew", "Skunk", "Squirrel", "Tiger", "Turtle", "Walrus", "Wolf", "Wolverine"];
let generatePassword = function(length = 16) {
let charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
let ret
@GramThanos
GramThanos / popup-fallback.js
Last active September 19, 2021 17:05
Browser popup with fallback (looking like chrome's GUI)
// Fallback Popup code
let PopupFallback = function(text, type='alert', defaultText='') {
return new Promise((resolve, reject) => {
try {
let iframe = document.createElement('iframe');
iframe.style.width = '450px';
iframe.style.position = 'fixed';
iframe.style.top = '20px';
iframe.style.left = '50%';
iframe.style.marginLeft = '-225px';
@GramThanos
GramThanos / variable-length-quantity.js
Last active August 30, 2021 06:43
Convert Integer to Variable-Length Quantity (VLQ) in JavaScript
// Integer to variable-length quantity (VLQ)
// This is partialy used by ASN.1 for OBJECT IDENTIFIERS
let intToVQL = function(n) {
// If simple form, just return (for simplecity)
// Next line can be removed and the results will be the same
if (n < 128) return new Uint8Array([n]);
// Initial array of bytes
let value = [];
@GramThanos
GramThanos / aes-string-crypto.js
Created April 26, 2021 21:08
Simple AES string encrypt/decrypt
// Simple AES encryption and decryption
// The password should be of high complexity
// as it is just pashed through a SHA256 before
// it is used to encrypt/decrypt
async function encrypt(message, password) {
let iv = window.crypto.getRandomValues(new Uint8Array(12));
let alg = {name: "AES-GCM", iv: iv};
let pwHash = await window.crypto.subtle.digest('SHA-256', new TextEncoder().encode(password));
let key = await window.crypto.subtle.importKey('raw', pwHash, alg, false, ['encrypt']);
@GramThanos
GramThanos / argon1.sh
Created February 6, 2021 20:05
ArgonOne RaspbianOS fan control script
#!/bin/bash
# ArgonOne RaspbianOS fan control script
# from https://download.argon40.com/argon1.sh
argon_create_file() {
if [ -f $1 ]; then
sudo rm $1
fi
sudo touch $1
sudo chmod 666 $1
/*
* Console.Title v0.0.2-beta
*
*
* MIT License
*
* Copyright (c) 2018 Grammatopoulos Athanasios-Vasileios
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@GramThanos
GramThanos / GitInfoHub.v0.0.1-beta.js
Created January 17, 2018 21:20
GitInfoHub - A Github API JSONP handler
/*
* GitInfoHub v0.0.1-beta
*
*
* MIT License
*
* Copyright (c) 2018 Grammatopoulos Athanasios-Vasileios
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal