Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Omonayajo Oladapo Adeola ragingprodigy

🏠
Working from home
View GitHub Profile
View Fixing Docker Overlay Issue
echo '{ "storage-driver": "devicemapper" }' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker.service
@ragingprodigy
ragingprodigy / README.md
Last active Oct 25, 2018 — forked from adambom/README.md
Backup Kubernetes Cluster State
View README.md

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
View DigitalOcean_Paste_in_Web_Console.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
@ragingprodigy
ragingprodigy / epel.txt
Created Dec 18, 2017
Enable EPEL manually in RHEL 7
View epel.txt
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 Dec 18, 2017
Ansible Playbook to Install Nginx
View nginx.yml
---
- 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 Dec 18, 2017
Ansible Playbook to enable EPEL Repo on Centos/RHEL 7
View epel.yml
---
- 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 Sep 8, 2017
Generate Queries to Delete all Foreign Keys from all tables in the current MySQL Database
View delete_all_foreign_keys.sql
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 Jul 28, 2017
Setting dynamic page titles in Angular 2+
View app.component.ts
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 Jul 13, 2017
CORS Middleware File for Laravel/Lumen
View CorsMiddleware.php
<?php
declare(strict_types = 1);
/**
* @author Oladapo Omonayajo <oladapo.omonayajo@lazada.com.ph>
* Created on 3/27/2017, 18:21
*/
namespace App\Http\Middleware;
View base64-encode.js
function encodeImage(imageUrl, callback) {
var URL = require('url'),
sURL = imageUrl,
oURL = URL.parse(sURL),
http = require('http');
var request = http.request({method:'GET', path:oURL.pathname, host: oURL.hostname, port:80});
request.end();
You can’t perform that action at this time.