Skip to content

Instantly share code, notes, and snippets.

View adisetiawan's full-sized avatar
🏠
Working from home

Adi adisetiawan

🏠
Working from home
View GitHub Profile
@adisetiawan
adisetiawan / drupal-8-nginx.md
Last active March 12, 2019 01:01
Drupal 8 NGINX Virtual Host
server {
    server_name drupal8.test;
    root /Users/username/drupal8/web;

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
@adisetiawan
adisetiawan / slugify.js
Created February 25, 2019 05:15 — forked from hagemann/slugify.js
Slugify makes a string URI-friendly
function slugify(string) {
const a = 'àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœṕŕßśșțùúüûǘẃẍÿź·/_,:;'
const b = 'aaaaaaaaceeeeghiiiimnnnoooooprssstuuuuuwxyz------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w\-]+/g, '') // Remove all non-word characters
Verifying my Blockstack ID is secured with the address 1EGRyeLqqXMcseD9fFVCh5zfBzc6WQFMTS https://explorer.blockstack.org/address/1EGRyeLqqXMcseD9fFVCh5zfBzc6WQFMTS
@adisetiawan
adisetiawan / Email Server (Linux, Unix, Mac).md
Created September 13, 2018 05:18 — forked from raelgc/Email Server (Linux, Unix, Mac).md
Setup a Local Only Email Server (Linux, Unix, Mac)

Setup a Local Only Email Server (Linux, Unix, Mac)

1 - Point localhost.com to your machine

Most of programs will not accept an email using just @localhost as domain. So, edit /etc/hosts file to make the domain localhost.com point to your machine, including this content to the file:

127.0.0.1 localhost.com

2 - Install Postfix

@adisetiawan
adisetiawan / README-Template.md
Created September 6, 2018 01:52 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@adisetiawan
adisetiawan / stream.js
Created February 20, 2018 14:42 — forked from DingGGu/stream.js
NodeJS Mp3 Streaming ExpressJS
var express = require('express');
var app = express();
var fs = require('fs');
app.listen(3000, function() {
console.log("[NodeJS] Application Listening on Port 3000");
});
app.get('/api/play/:key', function(req, res) {
var key = req.params.key;
@adisetiawan
adisetiawan / letitsnow.js
Created December 21, 2017 00:01 — forked from irony/letitsnow.js
God Jul Kodapor!
const outside = {weather: FRIGHTFUL}
const inside = {fire: DELIGHTFUL}
const go = places => places.some(p=>p>outside.weather)))
const snow = () => (outside.weather < inside.fire && !go(places)) {
let it = snow()
}
let it = snow()
//npm init -y
//npm install --save puppeteer
//usage: node script.js /path/to/input.html /path/to/output.pdf
//script.js
const puppeteer = require('puppeteer');
(async () => {
@adisetiawan
adisetiawan / index.js
Created May 25, 2017 01:05 — forked from schnerd/index.js
index.js
const CDP = require('chrome-remote-interface');
const argv = require('minimist')(process.argv.slice(2));
const file = require('fs');
// CLI Args
const url = argv.url || 'https://www.google.com';
const format = argv.format === 'jpeg' ? 'jpeg' : 'png';
const viewportWidth = argv.viewportWidth || 1440;
const viewportHeight = argv.viewportHeight || 900;
const delay = argv.delay || 0;
@adisetiawan
adisetiawan / nexmo-stream-audio.json
Created April 13, 2017 02:38
nexmo-stream-audio
[
{
"action": "stream",
"streamUrl": ["https://ia802508.us.archive.org/5/items/testmp3testfile/mpthreetest.mp3"]
}
]