Skip to content

Instantly share code, notes, and snippets.

View seandelaney's full-sized avatar
🏠
Working from home

Sean Delaney seandelaney

🏠
Working from home
View GitHub Profile
@jiavictor
jiavictor / AES256.cs
Last active March 16, 2022 13:59
Simple AES-256-CBC Test
using System;
using System.Text;
using System.Security.Cryptography;
namespace AES256
{
class Program
{
private string encrypt(string clearText, string secretKey, string initVector)
{
@nicolasdao
nicolasdao / open_source_licenses.md
Last active April 23, 2024 23:27
What you need to know to choose an open source license.
@aganglada
aganglada / script-cache.js
Created February 24, 2017 11:00
Script Cache Promise based
let counter = 0;
let scriptMap = new Map();
export const ScriptCache = (function(global) {
return function ScriptCache (scripts) {
const Cache = {};
Cache._onLoad = function(key) {
return (cb) => {
let stored = scriptMap.get(key);
let webpack = require('webpack');
let path = require('path');
module.exports = {
entry: {
app: './resources/assets/js/app.js',
vendor: ['vue', 'axios']
},
output: {
function checkForCloseMatch(longString, shortString) {
// too many false positives with very short strings
if (shortString.length < 3) return '';
// test if the shortString is in the string (so everything is fine)
if (longString.includes(shortString)) return '';
// split the shortString string into two at each postion e.g. g|mail gm|ail gma|il gmai|l
for (let i = 1; i < shortString.length; i++) {
const firstPart = shortString.substring(0, i);
@remarkablemark
remarkablemark / Dockerfile
Last active April 17, 2024 21:24
Install node and npm with nvm using Docker.
# set the base image to Debian
# https://hub.docker.com/_/debian/
FROM debian:latest
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# update the repository sources list
# and install dependencies
RUN apt-get update \
@parmentf
parmentf / GitCommitEmoji.md
Last active April 23, 2024 10:28
Git Commit message Emoji
@oslego
oslego / gist:f13e136ffeaa6174289a
Last active January 3, 2019 14:24 — forked from sl4m/gist:5091803
create self-signed certificate for localhost
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@turret-io
turret-io / aes_enc_dec.php
Last active September 4, 2023 00:10
AES encryption/decryption in PHP
<?php
// DEFINE our cipher
define('AES_256_CBC', 'aes-256-cbc');
// Generate a 256-bit encryption key
// This should be stored somewhere instead of recreating it each time
$encryption_key = openssl_random_pseudo_bytes(32);
// Generate an initialization vector
// This *MUST* be available for decryption as well
@Kevinlearynet
Kevinlearynet / largest-tables-in-mysql-database.sql
Last active November 8, 2022 06:49
Find the largest (sized by MB) tables in your MySQL database. Especially useful for diagnosing and fixing a bloated WordPress database.
# Find the largest tables in your MySQL database
SELECT
table_name as "Table",
table_rows as "Rows",
data_length as "Length",
index_length as "Index",
round(((data_length + index_length) / 1024 / 1024),2) as "Size (mb)"
FROM information_schema.TABLES
WHERE table_schema = "%%YOURDATABASE%%"
ORDER BY `Size (mb)` DESC