Skip to content

Instantly share code, notes, and snippets.

@bluzky
bluzky / github_export.exs
Last active March 30, 2022 08:56
Export your github pull request with Elixir
Mix.install([
{:tesla, "~> 1.4.3"},
{:csv, "~> 2.4"},
{:jason, "~> 1.3"}
])
defmodule GithubPR do
require Logger
def exec(repo, token) do
@ledongthuc
ledongthuc / Readme.md
Last active March 23, 2020 08:19
[Github Actions][Go] Check pull requests before merging

Create template actions that's used to verify Go language pull requests before merging. It's easy to custom the flow, tools with your case.

Put pr_checker.yml or pr_checker_simple.yml to .github/workflows/ and see how it works with your pull requests. Make sure you are allows to use actions of Github.

  • pr_checker.yml is using by mine with full checking tools. It will make sure every Go langauge pull requests will be buildable, testable, passed security checking and error-able code checking.
  • pr_checker_simple.yml is more simpler with buildable, testable.

References:

I've been working with Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥

Get the tools

@ledongthuc
ledongthuc / docker_postgres.sh
Last active June 29, 2020 17:02
Docker postgres actions
# Docker postgres backup data
docker exec -t -e PGPASSWORD={password} {container_name} pg_dump -U {username} --column-inserts --data-only --schema={schema} {database_name} > /path/to/exported/file.sql
# Docker postgres run script from outside
docker cp /host_path.sql captrondb:/container_inside.sql
docker exec -u {login_user} {container_name} psql {database_name} {db_username} -f /container_inside.sql # with continer username
docker exec {container_name} psql {database_name} {db_username} -f /container_inside.sql # without continer username
@npearce
npearce / install-docker.md
Last active June 5, 2024 20:07
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
# PLEASE REPLACE <username>, <public_key>, <admin_user>
# Add new user with sudo admin
useradd -m -d /home/<username> -s /bin/bash <username>
mkdir -p '/home/<username>/.ssh/'
touch /home/<username>/.ssh/authorized_keys
echo -n "<public_key>" >> /home/<username>/.ssh/authorized_keys
chown -R <username>:<username> /home/<username>/.ssh
@Ryanb58
Ryanb58 / install.md
Last active May 17, 2024 13:42
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@ruanbekker
ruanbekker / cheatsheet-elasticsearch.md
Last active April 24, 2024 00:11
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active June 21, 2024 21:39
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@tidus2102
tidus2102 / default.conf
Last active January 22, 2017 18:48
PHP-FPM NGINX Config
#/etc/nginx/conf.d/default.conf
server {
server_name domain.com;
rewrite ^(.*) http://www.domain.com$1 permanent;
}
server {
#listen 000.000.000.000:80;
server_name www.domain.com;
root /var/www/www.domain.com;