Skip to content

Instantly share code, notes, and snippets.

Working on stuff

Jan Bajena Bajena

Working on stuff
View GitHub Profile
iMilnb /
Last active May 22, 2021 01:47
AWS Terraform configuration: Stream CloudWatch Logs to ElasticSearch


This snippet is a sample showing how to implement CloudWatch Logs streaming to ElasticSearch using terraform. I wrote this gist because I didn't found a clear, end-to-end example on how to achieve this task. In particular, I understood the resource "aws_lambda_permission" "cloudwatch_allow" part by reading a couple of bug reports plus this stackoverflow post.

The js file is actually the Lambda function automatically created by AWS when creating this pipeline through the web console. I only added a endpoint variable handling so it is configurable from terraform.

mobz / getTimeZone.js
Last active February 26, 2020 09:08
You can scrape the timezone database in javascript using the Intl object [ licensed CC0 ]
View getTimeZone.js
function getTimeZone( tz_str, date ) {
const utc_c = {
timeZone: "UTC",
hour12: false,
year: "numeric",
month: "numeric",
day: "numeric",
hour: "numeric",
minute: "numeric",
mbajur / .md
Created April 29, 2016 07:16
How to create small, unique tokens in Ruby
View .md

How to create small, unique tokens in Ruby

That is is basically a "fork" of blog article i'm constantly returning to. It seems that the blog is down:

My choice: Dave Bass’s rand().to_s() trick

Dave Bass proposed this which I picked up for my implementation (here for an 8-chars token):

miguelmota / primes.json
Created December 15, 2015 02:31
Array of first 1,000 prime numbers
View primes.json
mpeteuil / rubocop_pre_commit_hook
Created August 3, 2013 17:44
Ruby style guide git pre-commit hook using Rubocop as the style guide checker. Only runs on staged ruby files that have been added and/or modified.
View rubocop_pre_commit_hook
#!/usr/bin/env ruby
require 'english'
require 'rubocop'
changed_files = `git status --porcelain`.split(/\n/).
select { |file_name_with_status|
file_name_with_status =~ ADDED_OR_MODIFIED
chetan /
Last active March 27, 2023 05:12
YARD cheatsheet