Skip to content

Instantly share code, notes, and snippets.

🕶
Being Awesome

Rob Parham Pamblam

🕶
Being Awesome
Block or report user

Report or block Pamblam

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Echo's discipline agreement .md

Echo's discipline agreement.

Every night we will review this list and calculate your point total for the day. For each rule you break you will lose points. You do not gain points for following rules just like the government doesn't reward you for following the law. You gain points for doing your chores and lose them when you do not do a chore. You may gain points for doing extra credit behaviours, but you will not lose points for not doing these. At the end of each day you are required to have a minimum of 2.5 points. You may choose from the demerits section to make up insufficient points. points earned via demerits do not earn a reward. Every 2 weeks your points will be cashed out at the rate of $1 per point. The first $10 you earn each period goes into a savings account and you may spend the rest as you choose.

Rules

  • 1pts Do all chores.
  • 5pts Be Honest.
  • .5 pts Remember phone/wallet/keys.
@Pamblam
Pamblam / instructions.md
Created Jul 12, 2019
Making High-Quality screencast animated gifs (Gnome Linux)
View instructions.md

Making High-Quality screencast animated gifs

  1. Use any screen recorder to record the screen. Gnome has a built-in recorder that is started and stopped with ctrl+shift+alt+r.
  2. Use kdenlive's edgecrop and speed effects to crop and adjust speed as required. render as mp4.
  3. Convert MP4 to several images:
sudo ffmpeg -i save_project.mp4  -r 20 'frames/frame-%03d.jpg'
  1. Use gimp to determine coordinates of required crop
@Pamblam
Pamblam / thread.js
Last active Jun 25, 2019
Creating disposable threads in javascript.
View thread.js
// Call the function with at least one parameter.
// The last parameter must be a function that will run on it's own thread
// Any params that are passed to Thread() will be available in the thread function
// The last param of the thread function must be
function Thread(){
return new Promise((resolve, reject)=>{
var args = Array.from(arguments);
var func = args.pop();
@Pamblam
Pamblam / levenshteinMatches.php
Created Mar 12, 2019
Find the closest matches to a given word.
View levenshteinMatches.php
<?php
$here = realpath(dirname(__FILE__));
$handle = fopen("$here/wordlist.txt", "r") or die("Couldn't get handle");
$matches = levenshteinMatches($handle, $_GET['word']);
echo "<pre>";
print_r($matches);
@Pamblam
Pamblam / runcmd.php
Last active Mar 11, 2019
run a command
View runcmd.php
<?php
/**
* Run a command with optional stdin
* @param string $cmd - the command to run
* @param string|string[] $stdin - the stdin to feed to the command
* @param string $cwd - the working directory in which to run the command
* @return object containing exit_status, stdout, stderr and elapsed
*/
function runcmd($cmd, $stdin=null, $cwd=null){
@Pamblam
Pamblam / text alignment with gd and .php
Created Mar 7, 2019
left, right, center and justify text in an image usign native php functions
View text alignment with gd and .php
<?php
$text = "Your Text Here
this is a test of the things and stuff and things";
$font_size = "12";
$color = "#000000";
$font_file = "/Applications/XAMPP/xamppfiles/htdocs/otcb/app/fonts/OldStreetSigns.ttf";
$background = "#FFFFFF";
$wrap_width = "250";
$alpha = 0;
@Pamblam
Pamblam / fetch examples .js
Last active Mar 18, 2019
PRACTICAL EXAMPLES OF FETCH
View fetch examples .js
// GET request with data, JSON response
function getJson(url, params={}){
var url = new URL(url);
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]))
return fetch(url)
.then(res=>res.json())
}
// POST request with data, JSON response
@Pamblam
Pamblam / checksum.js
Created Feb 1, 2019
generate a checksum for a list of files to ensure project integrity
View checksum.js
// This is 3 different files concatted for simplicity.
// USAGE:
// use in browser or via node to generate the checksum
var files = [
'listFiles.js',
'md5.js',
'private.properties',
'project.properties',
'project.xml',
@Pamblam
Pamblam / deep_compare.php
Created Jan 8, 2019
compare 2 data structures
View deep_compare.php
<?php
// https://3v4l.org/ZcDnE
/**
* compare 2 data structures.
* - Doesn't handle things like NaN that don't compare.
* - returns true if $b has all the same properties as $a and all properties have same values.
*/
function deepCompare($a, $b){
@Pamblam
Pamblam / color_helper.js
Created Jan 7, 2019
get a primary and secondary color name, estimated color name, and brightness from an rgb color and generate random colors
View color_helper.js
// http://jsfiddle.net/eLbznqx0/
class Color {
constructor(rgb) {
this.rgb = rgb;
this.colormap = {
"110": "yellow",
"101": "magenta",
"011": "cyan",
"100": "red",
You can’t perform that action at this time.