Skip to content

Instantly share code, notes, and snippets.

@gimbo
gimbo / git-summary.sh
Last active August 11, 2021 18:30
git-summary.sh - summarise git repos in some folder
#!/bin/bash
# git-summary - summarise git repos at some path
#
# Adapted from https://gist.github.com/lmj0011/1a8dd1e376234ac7bf0fba2748ecdd0f
#
# Andy Gimblett, March 2017
usage() {
anonymous
anonymous / preStop.sh
Created August 10, 2016 18:17
preStop script for mongo replica set in kubernetes
#!/usr/bin/env bash
PORT=27017
MONGO_LABEL=${TRACK}-mongo
LOGFILE="/postStart.log"
date > $LOGFILE
# Get the pods referenced by the Headless Service
function getPods() {
curl -s -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" \
anonymous
anonymous / postStart.sh
Created August 10, 2016 18:15
postStart hook for mongo replica set in kubernetes
#!/usr/bin/env bash
PORT=27017
# this is the label for the mongo pods.
# In my case it is prefixed by the TRACK variable (dev, test or prod)
# edit according to your setup
MONGO_LABEL=${TRACK}-mongo
# We log to a log file as there is no output to std when running the hook.
# We can check this log file to see what happened once the hook has run
LOGFILE="/postStart.log"
@ocombe
ocombe / translateUniversalLoader.ts
Last active May 11, 2023 07:01
ng2-translate file loader for Angular Universal (server side)
import {TranslateLoader} from "ng2-translate/ng2-translate";
import {Observable} from "rxjs/Observable";
import fs = require('fs');
export class TranslateUniversalLoader implements TranslateLoader {
constructor(private prefix: string = 'i18n', private suffix: string = '.json') {}
/**
* Gets the translations from the server
* @param lang
@ravishtiwari
ravishtiwari / Appfile.rb
Last active April 30, 2020 23:17
Ionic Build IPA with Fastlane tool
app_identifier "com.yourorganization.mytodoapp" # The bundle identifier of your app
apple_id "<You Apple Id>" # Your Apple email address
# You can uncomment any of the lines below and add your own
# team selection in case you're in multiple teams
# team_name "CAMobileApp"
# team_id "Q2CBPJ58CA"
# you can even provide different app identifiers, Apple IDs and team names per lane:
# https://github.com/KrauseFx/fastlane/blob/master/docs/Appfile.md
@gene1wood
gene1wood / all_aws_managed_policies.json
Last active April 4, 2024 18:11
A list of all AWS managed policies and they're policy documents as well as a short script to generate the list
This file has been truncated, but you can view the full file.
{
"APIGatewayServiceRolePolicy": {
"Arn": "arn:aws:iam::aws:policy/aws-service-role/APIGatewayServiceRolePolicy",
"AttachmentCount": 0,
"CreateDate": "2019-10-22T18:22:01+00:00",
"DefaultVersionId": "v6",
"Document": {
"Statement": [
{
"Action": [
@mlynch
mlynch / info.plist
Last active August 6, 2023 07:31
Disable App Transport Security in iOS 9
<!--
This disables app transport security and allows non-HTTPS requests.
Note: it is not recommended to use non-HTTPS requests for sensitive data. A better
approach is to fix the non-secure resources. However, this patch will work in a pinch.
To apply the fix in your Ionic/Cordova app, edit the file located here:
platforms/ios/MyApp/MyApp-Info.plist
And add this XML right before the end of the file inside of the last </dict> entry:
@mbixby
mbixby / gist:3dae2026a77a9a3d3de9
Last active January 5, 2019 06:55
Webpack Named Modules Plugin
var RequestShortener = require("webpack/lib/RequestShortener");
var _ = require("lodash");
/**
* TODO Docs
* @example new NamedModulesPlugin(/^\.\/app\/(viewmodels|records|adapters)/, /^\.\/app\/(.*)\.js$/)
*/
function NamedModulesPlugin(fileWhitelistRegex, replacementRegex) {
this.fileWhitelistRegex = fileWhitelistRegex;
this.replacementRegex = replacementRegex;
@voxxit
voxxit / USING-VAULT.md
Last active July 7, 2022 03:02
Consul + Vault + MySQL = <3
git clone https://gist.github.com/dd6f95398c1bdc9f1038.git vault
cd vault
docker-compose up -d
export VAULT_ADDR=http://192.168.99.100:8200

Initializing a vault:

vault init
@terranware
terranware / snsToSlack.js
Last active March 7, 2024 14:47
AWS Lambda function to Slack Channel hookup
var https = require('https');
var util = require('util');
exports.handler = function(event, context) {
console.log(JSON.stringify(event, null, 2));
console.log('From SNS:', event.Records[0].Sns.Message);
var postData = {
"channel": "#aws-sns",
"username": "AWS SNS via Lamda :: DevQa Cloud",