Skip to content

Instantly share code, notes, and snippets.

View mtvbrianking's full-sized avatar

Brian Matovu mtvbrianking

View GitHub Profile
@mtvbrianking
mtvbrianking / linux-foundation.md
Created October 5, 2021 18:45
Linux Foundation Certifiactions - LFCA . LFCS . LFCE

Linux Foundation Certified

IT Associate (LFCA)

Linux Fundamentals - 20%

  • Linux Operating System
  • File Management Commands
  • System Commands
  • General Networking Commands
@mtvbrianking
mtvbrianking / ubuntu_20_lamp_setup.txt
Last active March 8, 2022 10:26
Ubuntu 20 LAMP Setup
-- Prerequisites
apt update
apt upgrade
-- Supervisor
apt install supervisor -y
supervisord --version
@mtvbrianking
mtvbrianking / ssh.sh
Created August 9, 2021 20:23
SSH into remote servers
#!/bin/bash
# https://stackoverflow.com/q/13928116/2732184
# https://stackoverflow.com/q/1405324/2732184
SERVERS=("LOCAL", "REMOTE")
HOSTS=("127.0.0.1", "165.56.23.4")
PORTS=("22", "3409")
USERS=("root", "jdoe")
KEYS=("secret", "Ytrewq!123")
@mtvbrianking
mtvbrianking / xmltidy.sh
Last active July 25, 2021 19:56
xmllint indent and file overwrite helpers
# https://stackoverflow.com/a/40190976/2732184
# https://unix.stackexchange.com/a/50202/315380
# https://askubuntu.com/a/222371/575565
file=""
indent=" "
overwrite=0
while [ $# -gt 0 ]
do
@mtvbrianking
mtvbrianking / sublime-text-context-menu-install.bat
Last active June 24, 2021 11:24
Windows sublime context menu
@echo off
SET sublPath=C:\Program Files\Sublime Text\sublime_text.exe
rem add context menu to all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text" /t REG_SZ /v "" /d "Edit with Sublime Text" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text" /t REG_EXPAND_SZ /v "Icon" /d "%sublPath%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text\command" /t REG_SZ /v "" /d "%sublPath% \"%%1\"" /f
rem add context menu to folders
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text" /t REG_SZ /v "" /d "Open with Sublime Text" /f
@mtvbrianking
mtvbrianking / filter-on-return.js
Created October 31, 2020 10:22
jQuery filter on return
$.extend(true, $.fn.dataTable.defaults, {
initComplete: function(settings, json) {
var api = this.api();
var dtFilter = $.fn.dataTable.settings[0].aanFeatures.f;
var dtFilterInput = $('input', dtFilter);
dtFilterInput.unbind();
@mtvbrianking
mtvbrianking / laravel-routes.php
Last active November 22, 2021 14:01
Laravel Routes
<?php
use Illuminate\Support\Facades\Route;
function matches($patterns, $subject)
{
if(! is_array($patterns)) {
return preg_match($patterns, $subject);
}
@mtvbrianking
mtvbrianking / vuejs-select-binding-2.vue
Last active October 19, 2020 12:43
vuejs select element binding
<template>
<div id="checkout">
<div class="row mt-3">
<slot></slot>
<div class="col-12 form-group">
<label class="text-small text-uppercase required" for="payment_gateway">Payment Method</label>
<select id="payment_gateway" name="payment_gateway" class="form-control"
v-on:change="chooseGateway($event)" v-model="selected">
<option v-for="_gateway in gateways"
v-bind:value="_gateway.value"
@mtvbrianking
mtvbrianking / jquery-single-vs-multiple-selection.html
Created October 1, 2020 13:38
jQuery single vs multiple selection
<!DOCTYPE html>
<html>
<head>
<title>jQuery Single vs Multiple Selection</title>
<style>
.items {
padding: 0;
margin: 0;
list-style: none;
display: -webkit-box;
@mtvbrianking
mtvbrianking / array-of-objects-search.js
Last active May 27, 2021 06:34
Javascript array of objects search
"use strict";
var users = [
{
id: 1,
alias: "jdoe",
name: "John Doe"
},
{
id: 2,