Skip to content

Instantly share code, notes, and snippets.

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

Oladapo Omonayajo ragingprodigy

🏠
Working from home
View GitHub Profile
@ragingprodigy
ragingprodigy / splitCamelCase.js
Created December 9, 2020 17:48 — forked from JeffJacobson/splitCamelCase.js
Splits camelCase or PascalCase words into individual words.
/**
* Splits a Pascal-Case word into individual words separated by spaces.
* @param {Object} word
* @returns {String}
*/
function splitPascalCase(word) {
var wordRe = /($[a-z])|[A-Z][^A-Z]+/g;
return word.match(wordRe).join(" ");
}
echo '{ "storage-driver": "devicemapper" }' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker.service
@ragingprodigy
ragingprodigy / README.md
Last active October 25, 2018 10:10 — forked from adambom/README.md
Backup Kubernetes Cluster State

Run this in order to backup all you k8s cluster data. It will be saved in a folder bkp. To restore the cluster, you can run kubectl apply -f ${BACKUP_OUTPUT_DIR}.

Please note: this recovers all resources correctly, including dynamically generated PV's. However, it will not recover ELB endpoints. You will need to update any DNS entries manually, and manually remove the old ELB's.

Please note: This has not been tested with all resource types. Supported resource types include:

  • services
  • replicationcontrollers
  • secrets
  • deployments
  • horizontal pod autoscalers
// 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
@ragingprodigy
ragingprodigy / epel.txt
Created December 18, 2017 10:08
Enable EPEL manually in RHEL 7
EPEL repository manually ... to do this, first import the EPEL gpg key.
Execute : sudo rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
Now add the epel repository - execute : sudo nano /etc/yum.repos.d/epel.repo
Copy the following text and paste it into the empty file :
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
@ragingprodigy
ragingprodigy / nginx.yml
Created December 18, 2017 04:57
Ansible Playbook to Install Nginx
---
- hosts: all
sudo: yes
tasks:
- name: check registered the repository of nginx-release
shell: rpm -qa | grep nginx-release
register: result
ignore_errors: True
always_run: yes
@ragingprodigy
ragingprodigy / epel.yml
Created December 18, 2017 04:43
Ansible Playbook to enable EPEL Repo on Centos/RHEL 7
---
- hosts: all
sudo: yes
tasks:
- name: Install EPEL repo.
yum:
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm
state: present
@ragingprodigy
ragingprodigy / delete_all_foreign_keys.sql
Created September 8, 2017 07:40
Generate Queries to Delete all Foreign Keys from all tables in the current MySQL Database
SELECT CONCAT("alter table ", TABLE_NAME," drop foreign key ", CONSTRAINT_NAME,"; ") AS runMe
FROM information_schema.key_column_usage
WHERE TABLE_SCHEMA=DATABASE() AND CONSTRAINT_NAME LIKE '%ibfk%';
@ragingprodigy
ragingprodigy / app.component.ts
Created July 28, 2017 04:31
Setting dynamic page titles in Angular 2+
import { Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
import 'rxjs/add/operator/filter';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/mergeMap';
@Component({
selector: 'app-root',
@ragingprodigy
ragingprodigy / CorsMiddleware.php
Created July 13, 2017 00:36
CORS Middleware File for Laravel/Lumen
<?php
declare(strict_types = 1);
/**
* @author Oladapo Omonayajo <oladapo.omonayajo@lazada.com.ph>
* Created on 3/27/2017, 18:21
*/
namespace App\Http\Middleware;