Skip to content

Instantly share code, notes, and snippets.

View tamsanh's full-sized avatar

Tam Nguyen tamsanh

View GitHub Profile
@29decibel
29decibel / build.mjs
Created March 8, 2022 17:51
Use Svelte in Phoenix the simple way
import esbuild from "esbuild";
import esbuildSvelte from "esbuild-svelte";
import sveltePreprocess from "svelte-preprocess";
import { readdir } from "fs/promises";
async function allSvelteComponents() {
const baseDir = "./js/app/";
const all = await readdir(baseDir);
return all.filter((f) => f.endsWith(".svelte")).map((f) => `${baseDir}${f}`);
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#-----------------------------------------------------------------------------------------------
#copy emr conf
#-----------------------------------------------------------------------------------------------
emr_ip=10.135.241.137
sudo rm -rf /etc/yum.repos.d/emr-*.repo
sudo rm -rf /var/aws/emr/repoPublicKey.txt
sudo mkdir -p /var/aws/emr/
sudo chmod +r -R /var/aws/
sudo rm -rf /etc/spark/
sudo rm -rf /etc/hadoop/
@rhcarvalho
rhcarvalho / go.mod
Last active January 16, 2024 01:17
Example of using sentry-go and go-chi
module sentry.io/go/chi-example
go 1.13
require (
github.com/getsentry/sentry-go v0.4.0
github.com/go-chi/chi v4.0.3+incompatible
)
@janithl
janithl / goroutines.go
Created September 3, 2018 11:10
A simple Goroutine exercise, where a worker thread reads user input through a channel
package main
import (
"bufio"
"fmt"
"os"
"time"
)
type message struct {
@xiaom
xiaom / tmux_fabric.py
Created April 30, 2017 23:00 — forked from nopper/tmux_fabric.py
Tmux helper for fabric
from fabric.api import *
class Tmux(object):
"""Tmux helper for fabric"""
def __init__(self, session_name, run_cmd=run):
self.session_name = session_name
self.run_cmd = run_cmd
self.create_session()
@mcfdn
mcfdn / Multiple Deploy Keys in GitHub.md
Last active November 21, 2022 14:02
Using multiple GitHub deploy keys on a single server with a single user

Using multiple GitHub deploy keys on a single server with a single user

Within GitHub it is possible to set up two types of SSH key - account level SSH keys and and repository level SSH keys. These repository level SSH keys are known in GitHub as deploy keys.

Deploy keys are useful for deploying code because they do not rely on an individual user account, which is susceptible to change, to “store” the server keys.

There is, however, an ‘issue’ with using deploy keys; each key across all repositories on GitHub must be unique. No one key can be used more than once. This becomes a problem when deploying to repositories to the same server with the same user. If you create two keys, the SSH client will not know which key to use when connecting to GitHub.

One solution is to use an SSH config file to define which key to use in which situation. This isn’t as easy as it seems.. you might try something like this:

@ehernandez-xk
ehernandez-xk / upload-file-s3.go
Last active January 31, 2021 00:56
Uploading a file to AWS S3 using aws-sdk-go
/*
https://www.youtube.com/watch?v=iOGIKG3EptI
https://github.com/awslabs/aws-go-wordfreq-sample/blob/master/cmd/uploads3/main.go
https://docs.aws.amazon.com/sdk-for-go/api/aws/
- first configure your aws credentials run: aws configure
- go get -u github.com/aws/aws-sdk-go/aws
- login to UI web aws s3 interface
- go to S3 service
@josephspurrier
josephspurrier / values_pointers.go
Last active April 28, 2024 16:41
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@jaceklaskowski
jaceklaskowski / Rough Notes about CQRS and ES.md
Last active March 31, 2024 03:06
Rough Notes about CQRS and ES

Rough Notes about CQRS and ES

Once upon a time…

I once took notes (almost sentence by sentence with not much editing) about the architectural design concepts - Command and Query Responsibility Segregation (CQRS) and Event Sourcing (ES) - from a presentation of Greg Young and published it as a gist (with the times when a given sentence was heard).

I then found other summaries of the talk and the gist has since been growing up. See the revisions to know the changes and where they came from (aka the sources).

It seems inevitable to throw Domain Driven Design (DDD) in to the mix.