Skip to content

Instantly share code, notes, and snippets.

View edtshuma's full-sized avatar

Ed Tshuma edtshuma

View GitHub Profile
@edtshuma
edtshuma / number-pad-zero.js
Created May 11, 2018 13:11 — forked from endel/number-pad-zero.js
Simplest way for leading zero padding in JavaScript
Number.prototype.pad = function(size) {
var s = String(this);
while (s.length < (size || 2)) {s = "0" + s;}
return s;
}
(1).pad(3) // => "001"
(10).pad(3) // => "010"
(100).pad(3) // => "100"
@edtshuma
edtshuma / index.php
Created July 4, 2018 10:51 — forked from drizzentic/index.php
Sample USSD Application
<!-- MIT License
Copyright (c) 2016 Derrick Rono
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@edtshuma
edtshuma / json-over-soap-wrapper.js
Created December 4, 2018 14:22 — forked from magician11/json-over-soap-wrapper.js
How to a JSON API Wrapper for SOAP
const express = require('express');
const https = require('https');
const fs = require('fs');
const cors = require('cors');
const rpn = require('request-promise-native');
const bodyParser = require('body-parser');
/* eslint-disable comma-dangle,arrow-parens,max-len,no-console */
const app = express();
OneMoney integration wsdl
@edtshuma
edtshuma / vagrant-cheat-sheet.md
Created December 1, 2020 06:41 — forked from wpscholar/vagrant-cheat-sheet.md
Vagrant Cheat Sheet

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
@edtshuma
edtshuma / gist:44b617ba892a95d4affd9e36a76c6d01
Created December 9, 2020 13:48 — forked from hayderimran7/gist:78421229af85ae90177b
So what is the 'credentials-id' parameter and how to use it correctly in jenkins-job-builder yaml file of your job?
It took me a while, after multiple knocks on all openstack/cloudbees/jenkins IRCs and googling around, all of them proved to be fruitless that I finally figure what the deal about this parameter all about?
before posting the exact details, i just have a little rant : WHY IS THIS NOT IN THE DOCS OF JENKINS JOB BUILDER (JJB ) ???
Jenkins job builder docs are pretty concise and dont go into much details,
but anyway:
=================================
what is credentials-id parameter?
=================================
so you are writing a yaml file for your job 'foo.yaml' and you need to use a git repo, lets say its in github,
now github private repos are snowflaky where you need to provide credentials to github in order to clone them. Following is step-by-step howto:
@edtshuma
edtshuma / gist:c4ec63db997723f9e9c35ed3d5a5c80e
Last active December 9, 2020 13:48 — forked from hayderimran7/gist:78421229af85ae90177b
So what is the 'credentials-id' parameter and how to use it correctly in jenkins-job-builder yaml file of your job?
It took me a while, after multiple knocks on all openstack/cloudbees/jenkins IRCs and googling around, all of them proved to be fruitless that I finally figure what the deal about this parameter all about?
before posting the exact details, i just have a little rant : WHY IS THIS NOT IN THE DOCS OF JENKINS JOB BUILDER (JJB ) ???
Jenkins job builder docs are pretty concise and dont go into much details,
but anyway:
=================================
what is credentials-id parameter?
=================================
so you are writing a yaml file for your job 'foo.yaml' and you need to use a git repo, lets say its in github,
now github private repos are snowflaky where you need to provide credentials to github in order to clone them. Following is step-by-step howto:
@edtshuma
edtshuma / get_deployment_manifest.sh
Created August 4, 2022 15:25 — forked from si3mshady/get_deployment_manifest.sh
Generate k8s deployment manifest files after using helm
for dep in $(kubectl get deployment | awk '{print $1}'); do kubectl get deployment $dep -o yaml > $dep.yml; done
@edtshuma
edtshuma / gist:28a6e6976752ce8d7ba4d3d6f1e778a9
Created August 8, 2022 07:34 — forked from mrlesmithjr/gist:72e23d0a0cceefef553b83b4fce5d06f
Example GitLab CI Pipeline using Terraform, etc.
---
# Most pre-req tooling, etc. is installed using jumphosts.yml playbook
variables:
ADMIN_EMAIL: mrlesmithjr@gmail.com
CLOUD_PROVIDER: Azure # Define Supported Cloud Provider (Azure)
GIT_CRYPT_ENABLED: "true" # Must be lowercase (true|false)
GIT_SUBMODULE_STRATEGY: recursive
ORGANIZATION: example_org
PROJECT_NAME: example_project
TERRAFORM_VERSION: 0.12.28
@edtshuma
edtshuma / error_count_kubectl.awk
Created August 17, 2022 09:51 — forked from si3mshady/error_count_kubectl.awk
AWK practice - filter kubectl output to show counts for running, errorImagePull and imagePullBackup
BEGIN {
imagePullBackOff=0
running=0
errorImagePull=0
}
{