Skip to content

Instantly share code, notes, and snippets.

View qawemlilo's full-sized avatar

Qawelesizwe Mlilo qawemlilo

View GitHub Profile
@qawemlilo
qawemlilo / ping-monitor-ideas.md
Last active January 29, 2023 08:27
Ideas on how to integrate notification channels with ping-monitor
const Monitor = require('ping-monitor');

// how to get channels
const Mailer = require('@ping-monitor/email');
const Slakey = require('@ping-monitor/slack');
const TwiT = require('@ping-monitor/twitter');
const SMS = require('@ping-monitor/sms');
/bootstrap/compiled.php
/vendor
bower_components/
node_modules/
composer.phar
.env.*.php
.env.php
.env.local.php
.env.local
@qawemlilo
qawemlilo / random_color_array.js
Created October 31, 2022 07:34 — forked from mucar/random_color_array.js
Javascript Random Color Array
var colorArray = ['#FF6633', '#FFB399', '#FF33FF', '#FFFF99', '#00B3E6',
'#E6B333', '#3366E6', '#999966', '#99FF99', '#B34D4D',
'#80B300', '#809900', '#E6B3B3', '#6680B3', '#66991A',
'#FF99E6', '#CCFF1A', '#FF1A66', '#E6331A', '#33FFCC',
'#66994D', '#B366CC', '#4D8000', '#B33300', '#CC80CC',
'#66664D', '#991AFF', '#E666FF', '#4DB3FF', '#1AB399',
'#E666B3', '#33991A', '#CC9999', '#B3B31A', '#00E680',
'#4D8066', '#809980', '#E6FF80', '#1AFF33', '#999933',
'#FF3380', '#CCCC00', '#66E64D', '#4D80CC', '#9900B3',
'#E64D66', '#4DB380', '#FF4D4D', '#99E6E6', '#6666FF'];
@qawemlilo
qawemlilo / dropbox-php-auth.md
Created August 24, 2022 07:38 — forked from phuze/dropbox-php-auth.md
Dropbox API V2: PHP Authentication Process

Effective September 2021, Dropbox will be deprecating long-lived access tokens.

This GIST generally describes how to authenticate requests to Dropbox API v2, for anyone working on a server-side PHP Dropbox implementation.

It's important to understand three types of codes you'll encounter:

  1. Access Code - this is a one-time code that represents user-granted app access.
  2. Access Token - this is short-lived token that provides access to Dropbox API endpoints.
  3. Refresh Token - this is a long-lived token that allows you to fetch a fresh Access Token.
@qawemlilo
qawemlilo / fail2ban.md
Created March 18, 2022 08:05 — forked from AntoOnline/Fail2Ban Cheat Sheet.md
Fail2Ban Cheat Sheet

Fail2Ban Cheat Sheet

Note:

  • Fail2ban picks up the first date and syslong on Ubuntu 20.04 does not contain a year. Change syslog config to add year to timestamp. See my syslog gist for more info.
  • When using Docker you can change the log driver to syslog

Typical file paths:

@qawemlilo
qawemlilo / fail2ban.md
Created March 18, 2022 08:04 — forked from pixelchrome/fail2ban.md
fail2ban - cheatsheet

fail2ban

Installation - Ubuntu / Debian

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install fail2ban
@qawemlilo
qawemlilo / index.html
Created June 18, 2021 13:47 — forked from larsbouwens/index.html
The Netherlands GeoJSON
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<title>The Netherlands gejson map</title>
<script src="js/d3.v3.min.js"></script>
<style type="text/css">
path {fill: #000; stroke: #fff; stroke-width: 1;}}
</style>
@qawemlilo
qawemlilo / WordPress.class.php
Created October 8, 2020 15:47 — forked from Jamesking56/WordPress.class.php
Read Wordpress Export XML to PHP
<?php
/**
* WordPress class - Manages the WordPress XML file and gets all data from that.
*/
class Wordpress
{
public static $wpXML;
@qawemlilo
qawemlilo / node-streams.md
Last active September 9, 2020 05:37
Using Node streams to append audio files

Today I decided to clean up and organise files on windows computer at work. This process involved deleting files I no longer have use for and creating grouping the rest in folders. So I ended up with folders for audio, video, projects, ebooks, e.t.c.

One of the folders that I came across contained about 50 small mp3 files. Before deleting the files I had to play them just to make sure they didn't contain anything important. What do I know, turns out they clips of a DHH(the ROR creator) interview - please don't ask me how they got to my computer. He's quite an opinionated guy and I decided I wanted to keep the files. But 50 files? Wouldn't it be nice if I could glue them together into a single file? Well, being the hacker that I am I popped open my terminal and started writing a program.

I broke down the task to two main things.

  1. Read and sort the files according to their sequence
  2. Somehow combine the files and write them to a single file

The first thing turned out to be quite easy to do because th

@qawemlilo
qawemlilo / node_nginx_ssl.md
Created April 27, 2020 07:36 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user