Skip to content

Instantly share code, notes, and snippets.

View harley's full-sized avatar

Harley Trung harley

View GitHub Profile
@jferris
jferris / configmap.yaml
Last active October 28, 2024 01:42
Rails Kubernetes Manifests
apiVersion: v1
kind: ConfigMap
metadata:
name: example
namespace: default
data:
APPLICATION_HOST: example.com
LANG: en_US.UTF-8
PIDFILE: /tmp/server.pid
PORT: "3000"
@mattlima
mattlima / 01_rails_6_on_beanstalk.config
Last active February 1, 2024 19:22
Beanstalk config script for Rails 6
# Beanstalk ain't ready for Rails 6. This fix is courtesy of https://austingwalters.com/rails-6-on-elastic-beanstalk/
# Additional node 6 cleanup courtesy of https://github.com/nodesource/distributions/issues/486
commands:
00_remove_node_6_if_present:
command: "/bin/rm -rf /var/cache/yum && /usr/bin/yum remove -y nodejs && /bin/rm /etc/yum.repos.d/nodesource* && /usr/bin/yum clean all"
ignoreErrors: true
01_download_nodejs:
command: "curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -"
02_install_nodejs:
@sdolenc
sdolenc / 0.md
Last active June 23, 2023 14:25
Import Recurring Events to Google Calendar

One method of quickly creating a lot of events in google calendar is to import a CSV file. However, there is no support for directly adding "recurring" events (birthdays, anniversaries, etc). Here's the workarond.

Summarized steps

  1. create csv file with events (no recurring)
  2. import csv into a new, temporary google calendar
  3. export temporary google calendar to an ics file
  4. edit ics file to change events into recurring
  5. import ics file into a new, permanent google calendar.
  6. delete temporary google calendar
@crypticmind
crypticmind / README.md
Last active November 15, 2024 16:46
Setup lambda + API Gateway using localstack
@patmandenver
patmandenver / lambda slack relay
Created December 17, 2017 22:09
An AWS lambda slack webhook relay (make sure to change the path to your actual slack webhook URL
var https = require('https');
exports.handler = (event, context, callback) => {
console.log("MYLOG" + JSON.stringify(event))
//Custom Fields sent in from Distilio
var body = JSON.parse(event.body)
var name = body.name
var uri = body.uri
@ssaunier
ssaunier / cache.yml
Last active December 14, 2020 05:23
Speed up the AWS Elastic Beanstalk of your Rails deployment with bundle/assets caching
# .ebextensions/cache.config
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/02a_set_cache.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash
set -xe
@mankind
mankind / rails-jsonb-queries
Last active November 12, 2024 13:02
Ruby on Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@dfetterman
dfetterman / lambda_function-ECS-cloudwatch-slack.py
Last active April 6, 2024 14:40
Lambda function that takes ECS Cloudwatch events and sends a notification to Slack
# Written by Dane Fetterman on 12/1/2016
# https://aws.amazon.com/blogs/compute/monitor-cluster-state-with-amazon-ecs-event-stream/
# Where they use a cloud watch event from ECS to notify a SNS topic. We're
# sending a notification directly to slack instead
import requests
import json
from boto3 import session, client
@ryansch
ryansch / README.md
Created July 23, 2016 22:24
neovim + yadr
@Rich-Harris
Rich-Harris / service-workers.md
Last active November 5, 2024 06:39
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.