Skip to content

Instantly share code, notes, and snippets.

View muhfaris's full-sized avatar
:octocat:
Focusing

Muhammad Faris 'Afif muhfaris

:octocat:
Focusing
View GitHub Profile
@muhfaris
muhfaris / default
Created January 11, 2018 09:50
reserve proxy : from ip address to domain name
server {
listen 80;
server_name xxx.xxx.xxx.xxx;
# or
# server_name default_server
return 301 $scheme://domain.com$request_uri;
}
@muhfaris
muhfaris / curl.md
Created January 31, 2018 09:10 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@muhfaris
muhfaris / convertMS.js
Created April 9, 2018 03:52
convert milliseconds to time
function convertMS(ms) {
var d, h, m, s;
s = Math.floor(ms / 1000);
m = Math.floor(s / 60);
s = s % 60;
h = Math.floor(m / 60);
m = m % 60;
d = Math.floor(h / 24);
h = h % 24;
return { d: d, h: h, m: m, s: s };
@muhfaris
muhfaris / github.txt
Created April 15, 2018 23:35
remove history commit
# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH
# Add all the files:
git add -A
# Commit the changes:
git commit -am "Initial commit"
# Delete the old branch:
package main
import (
"fmt"
"net/http"
)
func main() {
fmt.Printf("Please input which directory\nwhat you want to share, start with \"/\":\n")
h := http.FileServer(http.Dir("/usr/share/nginx/html/app"))
@muhfaris
muhfaris / responsive-semantic-ui.css
Created July 21, 2018 01:30 — forked from bl4ck5un/responsive-semantic-ui.css
Responsive helpers (mobile-only etc.) for semantic-ui
/* Semantic UI has these classes, however they're only applicable to*/
/* grids, containers, rows and columns.*/
/* plus, there isn't any `mobile hidden`, `X hidden` class.*/
/* this snippet is using the same class names and same approach*/
/* plus a bit more but to all elements.*/
/* see https://github.com/Semantic-Org/Semantic-UI/issues/1114*/
/* Mobile */
@media only screen and (max-width: 767px) {
[class*="mobile hidden"],
@muhfaris
muhfaris / golang-tls.md
Created July 13, 2019 07:28 — forked from 6174/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key