Skip to content

Instantly share code, notes, and snippets.

Lawrence Cherone lcherone

View GitHub Profile
@lcherone
lcherone / encryption.js
Last active Apr 22, 2019
AES CBC Encryption helper nodejs
View encryption.js
const crypto = require("crypto");
/**
* AES CBC Encryption helper
*
* Usage:
* ``` javascript
//
const encryption = require('@lib/encryption');
View gist:55d982b6bd67421451dabde708d25522
.social_wrapper2,
.social_youtube,
.socialaccounts,
.socialakamai,
.socialarea,
.socialb,
.socialb_tg,
.socialbadge,
.socialbar-mobile,
.socialbar-wrap-bottom,
@lcherone
lcherone / dir.php
Created Sep 16, 2018
Directory Tree Menu
View dir.php
<?php
// https://stackoverflow.com/questions/52348639/how-to-generate-a-recursive-list-of-directories-and-files-with-hyperlinks-to-eac/52348780#52348780
function file_get_listing($path = '')
{
$return = [];
foreach (new IteratorIterator(new DirectoryIterator($path)) as $item) {
if ($item->isDot()) {
continue;
}
$info = [
View gist:8bd1e33dd90c5cc3d7d044f1a3660ad6
<?php
function isPrime($number) {
$n = abs($number);
$i = 2;
while ($i <= sqrt($n)) {
if ($n % $i === 0) {
return false;
}
$i++;
@lcherone
lcherone / developers.json
Last active Jul 11, 2018
snap-ui-featured items
View developers.json
[{
"id": "RT9mcUhVsRYrDLG8qnvGiy26NKvv6Qkd",
"title": "VLC",
"summary": "The ultimate media player",
"icon": "https://dashboard.snapcraft.io/site_media/appmedia/2016/07/vlc.png",
"name": "vlc",
"screenshots": [{
"url": "https://dashboard.snapcraft.io/site_media/appmedia/2016/07/vlc-2.0-poney.jpg"
},
{
View DigitalOcean_NoVNC_Paste.js
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1
@lcherone
lcherone / gh-pages-deploy.md
Created Apr 25, 2018 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).
View gh-pages-deploy.md

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@lcherone
lcherone / README.md
Last active Apr 9, 2018 — forked from remarkablemark/README.md
Classes - ES5 vs ES6
View README.md

JavaScript Classes - ES5 vs ES6

An example that shows the difference between creating a JavaScript class and subclass in ES5 and ES6.

@lcherone
lcherone / wait.sh
Last active Apr 6, 2018
Linux wait for network connection before continuing. Docker, LXC, containers, cloud-init
View wait.sh
#/bin/bash
echo "Waiting for network connection."
while [ 1 ]; do
if ping -q -c 1 -W 1 8.8.8.8 > /dev/null 2>&1; then
break;
fi
sleep 1
done
@lcherone
lcherone / hash_file_multi.php
Created Mar 26, 2018
hash_file_multi() hash a single file with multiple algorithms PHP
View hash_file_multi.php
<?php
function hash_file_multi($algos = [], $filename) {
if (!is_array($algos)) {
throw new \InvalidArgumentException('First argument must be an array');
}
if (!is_string($filename)) {
throw new \InvalidArgumentException('Second argument must be a string');
}
You can’t perform that action at this time.