Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Set status

Wildan Zulfikar wzulfikar

💭
Set status
View GitHub Profile
@wzulfikar
wzulfikar / run.sh
Last active Dec 4, 2020
Setup wordpress using docker. Tested on Ubuntu.
View run.sh
#!/bin/sh
# File: /opt/wordpress/run.sh
APP_NAME=acme-blog
WORKDIR=/opt/wordpress
if [ ! -f "uploads.ini" ]; then
touch ${WORKDIR}/uploads.ini
fi
@wzulfikar
wzulfikar / run.sh
Last active Dec 4, 2020
Setup nginx with letsencrypt automatic https using docker. Tested on Ubuntu.
View run.sh
#!/bin/sh
# File: /opt/nginx-proxy/run.sh
# If you are on ubuntu and have docker installed, you can automate the setup by running below command.
# Make sure to adjust the DEFAULT_EMAIL and WORKDIR according to your need. The command:
: '
export DEFAULT_EMAIL=myemail@mydomain.com WORKDIR=/opt/nginx-proxy && \
sudo mkdir ${WORKDIR} && \
curl -o /tmp/nginx-proxy.sh https://gist.githubusercontent.com/wzulfikar/957917c8ad84a6047bdb0831215daa51/raw/cf7acfe4fecbcd2cd9acf83ef0382cfc03fbbc63/run.sh && \
@wzulfikar
wzulfikar / setup_obs.sh
Last active Dec 4, 2020
Setup OBS Studio on Ubuntu
View setup_obs.sh
#!/bin/sh
# Download and run the script (tested on Ubuntu 20):
# curl -s https://raw.githubusercontent.com/wzulfikar/lab/master/bash/setup-obs-ubuntu.sh | sh
#
# Read notes about the script:
# https://www.notion.so/Setup-OBS-in-Ubuntu-for-24-7-YouTube-Live-Streaming-5949000d598b480aa422657d54ca7da4
#
# Once installed, you can access OBS using vnc client on port 6701.
View machine.js
const fetchMachine = Machine({
id: 'Point of Sale',
initial: 'place order',
context: {
retries: 0
},
states: {
'place order': {
on: {
'unpack qr': 'qrcode'
View machine.js
// Available variables:
// Machine (machine factory function)
// assign (action)
// XState (all XState exports)
const fetchMachine = Machine({
id: 'Point of Sale',
context: { attempts: 0 },
initial: 'idle',
View keybase.md

Keybase proof

I hereby claim:

  • I am wzulfikar on github.

  • I am wzulfikar (https://keybase.io/wzulfikar) on keybase.

  • I have a public key ASDwimH7OPEvqzHFVBGnJe6lWpzCz_sskDdNkffx8G1JBwo

View docker-daemon-log-opts.sh
#!/bin/sh
# create docker engine config at /etc/docker/daemon.json
# to limit the size of container logs.
# usage (with curl):
# curl -s https://gist.githubusercontent.com/wzulfikar/e7740906110beaa90216f8f37320f5d8/raw/docker-daemon-log-opts.sh | sh
config_dir="/etc/docker"
config_file="$config_dir/daemon.json"
max_size=50m
@wzulfikar
wzulfikar / shamir-demo.js
Created Oct 23, 2018
shamir secret sharing demo in js
View shamir-demo.js
const secrets = require('secrets.js-grempe')
const shamir = {
create: (plainText, totalShares, threshold) => {
// convert the text into a hex string
var pwHex = secrets.str2hex(passphrase); // => hex string
// split into 2 shares with a threshold of 2.
// 1 share will be sent to backend and stored there
// and another share will be kept by the user.
@wzulfikar
wzulfikar / .drone.yml
Last active Sep 15, 2020
Drone CI slack template. more on drone.io + slack integration: http://plugins.drone.io/drone-plugins/drone-slack/
View .drone.yml
pipeline:
build:
image: alpine
commands:
- echo "do something :v"
slack:
image: plugins/slack
channel: dev__builds
webhook: https://hooks.slack.com/services/...
@wzulfikar
wzulfikar / par-demo.scala
Created Nov 19, 2017
Using parallel function and thread in Scala.
View par-demo.scala
/**
* Using parallel function and thread in Scala.
*
* Run in scastie: https://scastie.scala-lang.org
*
*/
// Higher-order function that displays
// time elapsed to execute any given function
def timer (taskId : String, f: () => Unit) = {