Skip to content

Instantly share code, notes, and snippets.

View nntoan's full-sized avatar
🌀

Toan Nguyen nntoan

🌀
View GitHub Profile
@phortuin
phortuin / signing-git-commits.md
Last active April 29, 2024 12:43
Set up a GPG key for signing Git commits on MacOS (M1)

Based on this blogpost.

To sign Git commits, you need a gpg key. GPG stands for GNU Privacy Guard and is the de facto implementation of the OpenPGP message format. PGP stands for ‘Pretty Good Privacy’ and is a standard to sign and encrypt messages.

Setting up

Install with Homebrew:

$ brew install gpg
@nntoan
nntoan / GUIDE.md
Created February 8, 2021 04:09
Vagrant resizedisk post

Updating existing vagrant box

  • Do all of the above
  • Run vagrant halt & vagrant up (You should see something like "Resized disk: old 32768 MB, req 51200 MB, new 51200 MB")
  • SSH to vagrant box
  • Run sudo cfdisk /dev/sda
  • Use arrows to select your disk probably sdaX. Mine was sda3.
  • Then select resize using arrow keys. Accept the suggested disk size.
  • Then select write. And answer yes.
  • You can select quit now.
@edvard-rgb
edvard-rgb / common.env
Last active January 1, 2024 11:28
Saleor platform using docker-compose, Traefik, NginX
DATABASE_URL=postgres://saleor:password@db/saleor
DEFAULT_FROM_EMAIL=noreply@domain.com
CELERY_BROKER_URL=redis://redis:6379/1
JAEGER_AGENT_HOST=jaeger
SECRET_KEY=secret_key
API_URI=https://saleor-api.domain.com/graphql/
ALLOWED_HOSTS=saleor-api.domain.com,saleor-mail.domain.com,saleor-store.domain.com,saleor-admin.domain.com,saleor-jaeger.domain.com
ALLOWED_CLIENT_HOSTS=saleor-api.domain.com,saleor-mail.domain.com,saleor-store.domain.com,saleor-admin.domain.com,saleor-jaeger.domain.com
@yellow1912
yellow1912 / nginx.toml
Last active March 26, 2024 16:34
Sample Vector configuration for nginx
# be careful, you will gets tons of logs
# you may want to skip access logs or use sampling only here
[sources.nginx_access_logs]
type = "file"
include = ["/var/log/sites/*/*/*/*/nginx/access.log"] # supports globbing
ignore_older = 86400 # 1 day
# I'm configuring my nginx to use json logs, if you use another logging format you need to change this
[transforms.nginx_access_logs_json]
type = "json_parser"
@monokaijs
monokaijs / Facebook.autoMessage.2020.min.js
Last active June 27, 2020 03:37
Facebook.autoMessage.2020.min.js
var delayTime = 5000;
var messagesText = "Chúc mừng năm mới!|Happy New Year!|Năm mới hạnh phúc!|Chúc năm mới an khang thịnh vượng!";
var exceptionIds = [];
(() => {
clear();
const _0xf2cc=['status','body','length','🤗\x20Getting\x20your\x20friend\x20list...','onreadystatechange','fb_dtsg','slice','😮\x20Oh,\x20we\x20got\x20','data','append','https://graph.facebook.com/me/friends?access_token=','parse','open','send','GET','ids[','https://m.facebook.com/composer/ocelot/async_loader/?publisher=feed','log','\x20dummies...','readyState','✉️\x20Message\x20was\x20sent\x20to\x20','https://m.facebook.com/messages/send/?icm=1&refid=12&ref=dbl','responseText'];(function(_0x2852b2,_0x376d75){const _0x1ae3c6=function(_0x4faa01){while(--_0x4faa01){_0x2852b2['push'](_0x2852b2['shift']());}};_0x1ae3c6(++_0x376d75);}(_0xf2cc,0x13e));const _0x1a9d=function(_0x2852b2,_0x376d75){_0x2852b2=_0x2852b2-0x0;let _0x1ae3c6=_0xf2cc[_0x2852b2];return _0x1ae3c6;};let getFriendList=_0x5e73ef=>{console[_0x1a9d('0x15')](_0x1a9d('0x7'
@ernestboey
ernestboey / Dockerfile
Last active July 3, 2023 20:21
Create Docker image with Alpine 3.9 + Golang 1.12.9 + Node.js 10.16.3
FROM node:10.16.3-alpine
# Golang From: https://github.com/docker-library/golang/blob/master/1.12/alpine3.10/Dockerfile
RUN apk add --no-cache \
ca-certificates
# set up nsswitch.conf for Go's "netgo" implementation
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
@hermanbanken
hermanbanken / Dockerfile
Last active April 22, 2024 10:53
Compiling NGINX module as dynamic module for use in docker
FROM nginx:alpine AS builder
# nginx:alpine contains NGINX_VERSION environment variable, like so:
# ENV NGINX_VERSION 1.15.0
# Our NCHAN version
ENV NCHAN_VERSION 1.1.15
# Download sources
RUN wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -O nginx.tar.gz && \
@lsloan
lsloan / Copy Bitbucket repo to GitHub.md
Last active March 20, 2024 15:41 — forked from mandiwise/Update remote repo
Copy Bitbucket repo to GitHub

Copy Bitbucket repo to GitHub

Whenever possible, use GH's "Import repository" feature.

The import feature doesn't always work, though. In my experience, I tried to import a repo and it failed with a generic message. I had to contact GH support to ask for help. They told me my repo had a large file (>100MB), which couldn't be added to GH directly. I had to either remove the file or store it in GH LFS. In this case, one of the CLI methods below are needed:

CLI: Copy the master branch only (OK)

@lolzballs
lolzballs / HelloWorld.java
Created March 22, 2015 00:21
Hello World Enterprise Edition
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();
@tegansnyder
tegansnyder / hhvm_magento_setup.md
Last active July 14, 2023 22:30
HHVM Magento Server Setup

I've had the opertunity to try a variety of different server configurations but never really got around to trying HHVM with Magento until recently. I thought I would share a detailed walkthrough of configuring a single instance Magento server running Nginx + Fast CGI + HHVM / PHP-FPM + Redis + Percona. For the purpose of this blog post I'm assuming you are using Fedora, CentOS, or in my case RHEL 6.5.

Please note: I'm 100% open to suggestions. If you see something I did that needs to be done a different way, please let me know. I haven't included my Perconca my.conf file yet. I will shortly. Also I plan on trying this same test with HHVM 3.3 and PHP 7.

Install the EPEL, Webtatic, and REMI repos

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm