Skip to content

Instantly share code, notes, and snippets.

View joebui's full-sized avatar
👨‍💻
Coding, reading

Dien Bui joebui

👨‍💻
Coding, reading
View GitHub Profile
View iterm_automation.py
#!/usr/bin/env python3.7
# Import iterm2 library
import iterm2
async def main(connection):
# Get current window
app = await iterm2.async_get_app(connection)
window = app.current_terminal_window
if window is not None:
View lambda-origin-response.js
exports.handler = (event, context, callback) => {
const response = event.Records[0].cf.response;
const requestUri = event.Records[0].cf.request.uri;
try {
if (requestUri.endsWith('.br')) {
// the browser to decode using brotli algorithm.
addContentEncoding('br', response);
} else {
if (requestUri.endsWith('.gz')) {
View lambda-origin-request.js
'use strict';
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
exports.handler = async event => {
const request = event.Records[0].cf.request;
try {
if (request.uri && request.headers['accept-encoding']) {
View docker-sync.yml
version: "2"
syncs:
app-code-sync:
# Source directory
src: '.'
# This will exclude the files/folders you specify.
sync_excludes: [
'.git'
]
sync_host_ip: '127.0.0.1'
View docker-compose.yml
version: '2'
services:
rails:
command: sh -c "rm -r tmp; bundle install; bundle exec rails s -b '0.0.0.0'"
volumes:
- ".:/webapp"
image: baseimage
container_name: rails_server
@joebui
joebui / docker-compose-dev.yml
Last active May 7, 2019 15:13
docker-sync sample
View docker-compose-dev.yml
version: '2'
services:
# The "rails" attribute is the service name in docker-compose.yml
rails:
volumes:
- app-code-sync:/webapp:nocopy
volumes:
app-code-sync:
external: true