Skip to content

Instantly share code, notes, and snippets.

View mateothegreat's full-sized avatar
🤘
it ain't easy.

Matthew Davis mateothegreat

🤘
it ain't easy.
View GitHub Profile
gcloud config get-value core/account
@mateothegreat
mateothegreat / awesome.component.ts
Last active February 14, 2019 11:36
Retrieve the hash value of a route (#myhash)
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-awesome',
templateUrl: './app-awesome.component.html',
styleUrls: [ './app-awesome.component.scss' ]
})
export class AwesomeComponent {
const https = require('https')
const data = JSON.stringify({
someProp: 'some value'
});
const options = {
while true; do
mycommand &
last_pid=$!
sleep(60) // 60 seconds
kill -KILL $last_pid
db.createUser({
user: "admin" ,
pwd: "password",
roles: ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"]
})
@mateothegreat
mateothegreat / install.sh
Created October 5, 2018 19:53
Install MySQL Top (mtop) on RHEL/CentOS
#!/bin/sh
curl -L -O https://sourceforge.net/projects/mtop/files/mtop/v0.6.6/mtop-0.6.6.tar.gz
tar -xvzf mtop-0.6.6.tar.gz
rm -rf mtop-0.6.6.tar.gz
cd mtop-0.6.6
yum install -y perl-devel cpan perl-DBD-MySQL
cpan force install Curses
@mateothegreat
mateothegreat / Jenkinsfile
Created June 5, 2018 05:48
Jenkins pipeline with k8/docker support
pipeline {
agent any
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '1'))
}
@mateothegreat
mateothegreat / haproxy.cfg
Created May 21, 2018 10:25
Rate Limiting with HAproxy
[root@ip-172-31-20-63 centos]# cat /etc/haproxy/haproxy.cfg
defaults
option http-server-close
mode http
timeout http-request 5s
timeout connect 5s
timeout server 10s
timeout client 30s
@mateothegreat
mateothegreat / generate_certs.sh
Last active April 9, 2018 22:32
Secure Docker Daemon with TLS
openssl genrsa -out ca-key.pem 4096
openssl req -x509 -new -nodes -key ca-key.pem -days 10000 -out ca.pem -subj '/CN=docker-CA'
openssl genrsa -out key.pem 4096
openssl req -new -key key.pem -out cert.csr -subj '/CN=docker-client' -config openssl.cnf
openssl x509 -req -in cert.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out cert.pem -days 365 -extensions v3_req -extfile openssl.cnf
@mateothegreat
mateothegreat / ultimate-ut-cheat-sheet.md
Created March 14, 2018 06:34 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies