Skip to content

Instantly share code, notes, and snippets.

@swyxio
swyxio / cloudos.md
Last active May 3, 2023 12:23
Cloud Operating Systems and Reconstituting the Monolith. tweet responses: https://twitter.com/swyx/status/1226257539886669825?s=20
@posener
posener / go-shebang-story.md
Last active March 15, 2025 16:08
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@Ron3
Ron3 / AWS-Kinesis初探
Created March 24, 2017 10:16
AWS Kinesis Stream
2017年3月20日 by Ron
Email: [email protected](如有错误, 欢迎指证.如有问题,欢迎讨论)
配套代码的git地址:
git: [email protected]:Ron3/AWS-Kinesis.git
https: https://github.com/Ron3/AWS-Kinesis.git
一直以来,我都对Amazon Kinesis Stream(以下称Kinesis)充满着好奇,一直在慢慢啃文档,但相对来说,还是不够仔细的.那既然看了
就写个我对Kinesis的理解与总结吧.我第一次接触这个概念,应该是在第一次参加AWS会议的时候,卓动--张穗文分享了他们如何利用Kinesis做用户
行为分析的.然而,我也正好曾经做过一个类似的,但是我们没有借助Kinesis来做,是写把LOG写成文件,然后采用Rsync同步到另外一台机器,在写入MySQL.
@therealchucknorris
therealchucknorris / index_dynamodb_with_cloudsearch_using_lambda.py
Created August 26, 2016 15:53
Indexing Amazon DynamoDB Content with Amazon CloudSearch Service Using AWS Lambda
import base64
import datetime
import json
import os
import time
import traceback
import urlparse
import botocore.auth
import botocore.awsrequest
@cocoalabs
cocoalabs / gist:2fb7dc2199b0d4bf160364b8e557eb66
Created August 15, 2016 21:50
Color Terminal for bash/zsh etc..
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
@vedit
vedit / gist:ec8b9b16d403a0dd410791ad62ad48ef
Last active July 24, 2017 16:19 — forked from jamesonjlee/gist:11271979
dynamodb local setup
#!/bin/bash
DYNAMODB_USER=vagrant
sudo apt-get install openjdk-7-jre-headless -y
cd /home/${DYNAMODB_USER}/
mkdir -p dynamodb
cd dynamodb

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@bcavagnolo
bcavagnolo / install-dynamodb-local
Last active November 21, 2024 03:34
A script to install dynamodb local
#!/usr/bin/env bash
set -e
set -x
[ "${DYNAMODB_HOME}" = "" ] && DYNAMODB_HOME=/opt/dynamodb
DYNAMODB_FILE=dynamodb_local_latest.tar.gz
DYNAMODB_URL=http://dynamodb-local.s3-website-us-west-2.amazonaws.com/${DYNAMODB_FILE}
DYNAMODB_JAR=DynamoDBLocal.jar
DYNAMODB_LOG=/var/log/dynamodb.log
@1901
1901 / timezone.lua
Last active March 25, 2023 08:26
lua中获取本地时区(timezone)的方法
--[[
打印时区信息
--]]
function os.printTimezone()
local t = os.time()
local ut = os.date('!*t',t)
local lt = os.date('*t',t)
local tzdt = (lt.hour - ut.hour) * 3600 + (lt.min - ut.min) * 60
print(string.format("本地时间与标准时间差 %d(%.1f小时) 分钟", tzdt, tzdt / 3600))
end