Skip to content

Instantly share code, notes, and snippets.

View goeroeku's full-sized avatar

Agus Indra Cahaya goeroeku

View GitHub Profile
@goeroeku
goeroeku / README.md
Created September 10, 2020 11:54 — forked from mul14/README.md
Simple Laravel Search Trait

Usage

Put SearchTrait.php in app directory. Then use SearchTrait in your model, like so

use App\SearchTrait;
use Illuminate\Database\Eloquent\Model;

class Article extends Model 
{
@goeroeku
goeroeku / fastcgi-php.conf
Last active July 22, 2020 22:53
Script VPS
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
@goeroeku
goeroeku / cloudflared
Created April 9, 2020 02:10 — forked from sbooth/cloudflared
dnsmasq with dnscrypt-proxy + cloudflared
# /etc/logrotate.d/cloudflared
/var/log/cloudflared/cloudflared.log {
rotate 7
daily
compress
missingok
notifempty
}
@goeroeku
goeroeku / kvm_minikube.md
Created April 3, 2020 23:54 — forked from alexellis/kvm_minikube.md
Run multiple minikube Kubernetes clusters on Ubuntu Linux with KVM

Ramp up your Kubernetes development, CI-tooling or testing workflow by running multiple Kubernetes clusters on Ubuntu Linux with KVM and minikube.

In this tutorial we will combine the popular minikube tool with Linux's Kernel-based Virtual Machine (KVM) support. It is a great way to re-purpose an old machine that you found on eBay or have gathering gust under your desk. An Intel NUC would also make a great host for this tutorial if you want to buy some new hardware. Another popular angle is to use a bare metal host in the cloud and I've provided some details on that below.

We'll set up all the tooling so that you can build one or many single-node Kubernetes clusters and then deploy applications to them such as OpenFaaS using familiar tooling like helm. I'll then show you how to access the Kubernetes clusters from a remote machine such as your laptop.

Pre-reqs

  • This tutorial uses Ubuntu 16.04 as a base installation, but other distributions are supported by KVM. You'll need to find out how to install
@goeroeku
goeroeku / eslint_prettier_airbnb.md
Created March 14, 2020 03:09 — forked from bradtraversy/eslint_prettier_airbnb.md
ESLint, Prettier & Airbnb Setup

VSCode - ESLint, Prettier & Airbnb Setup

1. Install ESLint & Prettier extensions for VSCode

Optional - Set format on save and any global prettier options

2. Install Packages

npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
# remove specific file from git cache
git rm --cached filename
# remove all files from git cache
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
@goeroeku
goeroeku / .prettierrc.md
Created March 11, 2020 04:27
All about VS Code - Prettier - ESLint

Rule:

  1. wraping if length : 100
  2. using single Quote
  3. using comma
  4. using parenthesis
{
  "printWidth": 100,
  "singleQuote": true,
 "trailingComma": "all",
@goeroeku
goeroeku / babelInterpreter.sh
Created March 6, 2020 13:25 — forked from cagataycali/babelInterpreter.sh
Start pm2 process with babel-node interpreter
pm2 start app.js --interpreter ./node_modules/.bin/babel-node
@goeroeku
goeroeku / web-scraper-node-js.md
Created March 6, 2020 05:28 — forked from corinneling/web-scraper-node-js.md
Node web scraper with axios and cheerio

Node JS Web Scraper

I this is part of the first node web scraper I created with axios and cheerio. I took out all of the logic, since I only wanted to showcase how a basic setup for a nodejs web scraper would look.

const cheerio = require('cheerio'),
      axios = require('axios'),
      url = `<url goes here>`;
 
@goeroeku
goeroeku / php-fpm.ini
Created April 27, 2019 09:22 — forked from garethrees/php-fpm.ini
Default php fpm pool configuration
; Start a new pool named 'www'.
[www]
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.