Skip to content

Instantly share code, notes, and snippets.

@oroce
oroce / bunyan-pipe-to-mongodb.js
Created November 10, 2012 21:29
pipe bunyan logger into mongodb (even with node-restify)
var mongoCol = require( "mongo-col" ),
mongoStream = require( "mongo-stream" ),
mongoInsertStream = mongoStream( mongoCol( "piped-collection", null, {
dbOptions:{
safe: true
}
})),
Logger = require( "bunyan" );
new Logger({
@IntuitDeveloperRelations
IntuitDeveloperRelations / CAD-updateInsitutionLoginWithRefreshAndEmptyCredentials.cs
Last active December 20, 2015 15:49
IPP CAD .NET SDK / UpdateInstitutionLogin passing empty credentials for refresh
int institutionLoginId = 3333; //Returned from DiscoverAndAddAccounts call
InstitutionLogin institutionLogin = new InstitutionLogin(); //Instantiate the object but do not specify credentials
Challenges challenges = new Challenges();
AggregationCategorizationService aggCategorizationService = Services.CADService.GetService(Cache, HttpContext.Current.User.Identity.Name);
aggCategorizationService.UpdateInstitutionLogin(institutionLoginId, institutionLogin, true, out challenges);
@mohitmayank
mohitmayank / mixpanel-amd-main.js
Last active December 20, 2015 16:38
AMD Mixpanel 2.2 Javascript Load Snippet
/*global require*/
'use strict';
require.config({
paths: {
'mixpanel' : '//cdn.mxpnl.com/libs/mixpanel-2.2.min',
},
shim: {
mixpanel: {
@goopi
goopi / tumblrproxy
Created September 4, 2013 17:17
An example of proxying a Tumblr blog as a subdirectory in nginx (w/o regexs)
server {
# ...
location / {
proxy_set_header Accept-Encoding '';
proxy_pass http://<NAME>.tumblr.com/;
sub_filter http://<NAME>.tumblr.com/post /post;
sub_filter_once off;
}
@dweinstein
dweinstein / Dockerfile
Created March 14, 2014 15:37
testProject
FROM ubuntu
MAINTAINER David Weinstein <david@bitjudo.com>
# install our dependencies and nodejs
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get -y install python-software-properties git build-essential
RUN add-apt-repository -y ppa:chris-lea/node.js
RUN apt-get update
RUN apt-get -y install nodejs
@tristanfisher
tristanfisher / Ansible-Vault how-to.md
Last active June 11, 2024 13:23
A short tutorial on how to use Vault in your Ansible workflow. Ansible-vault allows you to more safely store sensitive information in a source code repository or on disk.

Working with ansible-vault


I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.

What I decided on was the following: put your secret information into a vars file, reference that vars file from your task, and encrypt the whole vars file using ansible-vault encrypt.

Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.

@ccampanale
ccampanale / vaultsealmanager.sh
Created December 10, 2015 19:31
Bash shell script to check seal status for local vault server and attempt to unseal using keys secured in vault secret store. Supports HA Vault clusters with TLS with unseal keys stored as secrets in vault (see code). Relies on registered service vault.service.consul, in place DNS configuration, and a single unsealed vault instance in your clust…
#!/bin/bash
export vault=/usr/local/bin/vault
export VAULT_TOKEN=$(cat /root/.vault-token)
vault_cacert='-ca-cert=/path/to/your/ca.pem'
local_vault="-address=https://$(hostname -f):8200"
unsealed_vault="-address=https://$(getent hosts $(dig +short vault.service.consul | tail -n 1) | awk '{ print $2 }'):8200"
leader_vault="-address=https://$($vault status $vault_cacert $unsealed_vault 2> /dev/null | grep Leader | awk '{ print $2 }' | sed 's/^http\(\|s\):\/\///g'):8200"
vault_read="$vault read $vault_cacert $leader_vault"
vault_unseal="$vault unseal $vault_cacert $local_vault"
@tejacques
tejacques / HOCBaseRender.tsx
Last active May 2, 2022 13:05
React Higher Order Components in TypeScript
import * as React from 'react';
import { Component } from 'react';
export default function HOCBaseRender<Props, State, ComponentState>(
Comp: new() => Component<Props & State, ComponentState>) {
return class HOCBase extends Component<Props, State> {
render() {
return <Comp {...this.props} {...this.state}/>;
}
}
@hallettj
hallettj / Makefile
Last active December 10, 2023 13:32
Makefile for transpiling with Babel & Flow in a Node app, or in a client- or server-side shared library
# Makefile for transpiling with Babel in a Node app, or in a client- or
# server-side shared library.
.PHONY: all clean
# Install `babel-cli` in a project to get the transpiler.
babel := node_modules/.bin/babel
# Identify modules to be transpiled by recursively searching the `src/`
# directory.
@mkatychev
mkatychev / diffignore.sh
Last active October 23, 2019 20:12
Parse A .ignore file for diffing git
#!/usr/bin/env bash
# https://github.com/ggreer/the_silver_searcher/wiki/Advanced-Usage#ignore
# git diff master -- $(diffignore.sh)
DIFFI=''
test -f ".diffignore" || cp ./scripts/.diffignore.base ./.diffignore || exit 1
while read -r ignore;do