Skip to content

Instantly share code, notes, and snippets.

@jaydorsey
jaydorsey / private_bundle_install_gist.md
Created May 25, 2022 01:22
Setting up a github/bundle token for privately hosted repos

If your Gemfile has a privately hosted package referenced similar to this:

gem 'sekret', git: 'https://github.com/my-private-group/sekret.git', branch: 'main'

You may see a prompt when running bundle install, or other bundler commands, to enter your github username & password.

To resolve this, you need to generate a token and add it to your system.

Generating a token

@naptar
naptar / hangouts.py
Last active January 12, 2022 00:54
Convert/Parse Google Takeout/Export Data Hangouts/Chat into individual conversations
# Run this in the same directory as the Hangouts.json file generated by Google Takeout / Data Export tool.
# python3 hangouts.py
import json
import datetime
import os
import shutil
import re
chat_dir = "hangouts"
@mattiaerre
mattiaerre / open-component-renderer.js
Last active August 20, 2017 22:45
how to client side render an OpenComponents component using the Console (Developer Tools)
((oc, $) => {
// see: https://github.com/opentable/oc/wiki/Browser-client#ocbuild-options
const html = oc.build({
baseUrl: 'http://localhost:3030',
name: 'pi-baltimore-special-offers-promo-banners',
version: '1.X.X',
parameters: {
banner: 'purple-pasta'
}
});
@krambertech
krambertech / Component.jsx
Created July 2, 2016 10:44
ReactJS: Input fire onChange when user stopped typing (or pressed Enter key)
import React, { Component } from 'react';
import TextField from 'components/base/TextField';
const WAIT_INTERVAL = 1000;
const ENTER_KEY = 13;
export default class TextSearch extends Component {
constructor(props) {
super();
@twilson63
twilson63 / README.md
Last active February 28, 2019 17:24
Offline First Native Web Applications with couchdb or pouchdb

Building Offline First Native Web Applications

Creating Offline First Native Web Applications using PouchDB and CouchDB and replication is a nice approach to remove the challenges keeping the client database insync with the server database.

One thing that always comes up is security, and security is very important and should not be taken lightly. Using implementations like JWT or JsonWebToken and external authentication services like Auth0 and StormPath can create a solid pattern to keep your secrets off of your client.

Using JWT, when the user authenticates with the JWT Server, they receive a token, this token can be used to access

@shreyaskarnik
shreyaskarnik / Instructions.md
Last active March 24, 2023 15:35
Route Docker Logs to ELK Stack
  • With Docker 1.8.0 shipped new log-driver for GELF via UDP, this means that the logs from Docker Container(s) can be shipped directly to the ELK stack for further analysis.
  • This tutorial will illustrate how to use the GELF log-driver with Docker engine.
  • Step 1: Setup ELK Stack:
    • docker run -d --name es elasticsearch
    • docker run -d --name logstash --link es:elasticsearch logstash -v /tmp/logstash.conf:/config-dir/logstash.conf logstash logstash -f /config-dir/logstash.conf
    • Note the config for Logstash can be found at this link
    • docker run --link es:elasticsearch -d kibana
  • Once the ELK stack is up now let's fire up our nginx container which ships its logs to ELK stack.
  • LOGSTASH_ADDRESS=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' logstash)
  • `docker run -d --net=host --log-driver=gelf --log-opt gelf-address=u
@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
@tjamps
tjamps / README.md
Last active February 29, 2024 14:57
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

#!/bin/sh
### BEGIN INIT INFO
# Provides: dockercompose
# Required-Start: $docker
# Required-Stop: $docker
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Docker Services
### END INIT INFO
@endel
endel / authentication.js
Last active March 24, 2016 08:55
ng-admin authentication with hook https://github.com/doubleleft/hook
var app = angular.module('admin', ['ng-admin']),
hook = new Hook.Client({...});
var headerNav, pageWrapper, restangular;
if (hook.auth.currentUser && hook.auth.currentUser.role != 'admin') {
hook.auth.logout();
}
function hideMenu() {