Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠

Noval Agung Prayogo novalagung

🏠
View GitHub Profile
@novalagung
novalagung / world_controller.go
Last active May 13, 2020
knotv1-http-test-100-coverage
View world_controller.go
package controllers
import (
"github.com/eaciit/knot/knot.v1"
"github.com/eaciit/toolkit"
)
type WorldController struct {
}
View course-docker-kubernetes-fast-7-replicas-and-hpa.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app-deployment5
spec:
replicas: 3
selector:
matchLabels:
name: my-app5
template:
View course-docker-kubernetes-fast-schema.sql
CREATE DATABASE IF NOT EXISTS hello_world;
USE hello_world;
CREATE TABLE IF NOT EXISTS users (
id int NOT NULL AUTO_INCREMENT,
first_name VARCHAR(255) NOT NULL,
last_name VARCHAR(255),
birth DATETIME,
PRIMARY KEY (id)
);
@novalagung
novalagung / goth
Last active Apr 4, 2020 — forked from ammario/goth
golang test coverage html
View goth
#!/bin/bash
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
View es6-to-es5-babel-cli.md

transpile es6 into es5 using babel cli.

first install required packages globally.

npm install -g @babel/core @babel/node @babel/preset-env @babel/cli

then use command below to perform transpilation.

@novalagung
novalagung / pr.md
Created Feb 19, 2020 — forked from karlhorky/pr.md
Fetch all GitHub pull requests to local tracking branches
View pr.md
View nginx-selinux-webroot
# list stuff with it's security context
ls -lrtZ
# then adjust the security context using chcon
sudo chcon -v --user=system_u ride-dev
sudo chcon -R -v --type=httpd_sys_content_t ride-dev/*
semanage port -l | grep http
semanage port -a -t http_port_t -p tcp 8085
@novalagung
novalagung / go-mod-private-repo-terminal-prompt.sh
Created Jan 21, 2020
go modules install allow private repo by enabling terminal prompt
View go-mod-private-repo-terminal-prompt.sh
GIT_TERMINAL_PROMPT=1 go mod tidy
@novalagung
novalagung / uitextview-dynamic-height-with-autolayout-enabled.md
Last active Sep 24, 2019
make UITextView height dynamically follow it's content even with Auto Layout enabled
View uitextview-dynamic-height-with-autolayout-enabled.md

The key to make text view height follow it's content is by NOT SET HEIGHT CONSTRAINT and DISABLE THE SCROLL.

theTextView.isScrollEnabled = false
theTextView.text = "some text"
theTextView.sizeToFit()

But, if you already set the height constraint, then make it inactive

@novalagung
novalagung / iptables-allow-ssh-http-https-from-certain-ip-but-block-all-others.sh
Last active Jul 10, 2019
iptables example to allow ssh, and block every incoming http and https requests except certain ips
View iptables-allow-ssh-http-https-from-certain-ip-but-block-all-others.sh
# allow incoming ssh access from anywhere
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
# allow incoming http & https requests from local
sudo iptables -A INPUT -p tcp --dport 80 -s 127.0.0.1 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -s 127.0.0.1 -j ACCEPT
# allow incoming http & https requests from specific ips
sudo iptables -A INPUT -p tcp --dport 80 -s 13.250.120.208 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -s 13.250.120.208 -j ACCEPT
You can’t perform that action at this time.