Skip to content

Instantly share code, notes, and snippets.

View wzulfikar's full-sized avatar
💭
Set status

Wildan Zulfikar wzulfikar

💭
Set status
View GitHub Profile
@wzulfikar
wzulfikar / setup_obs.sh
Last active December 4, 2020 08:31
Setup OBS Studio on Ubuntu
#!/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.
@wzulfikar
wzulfikar / machine.js
Last active July 25, 2019 09:05
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'Point of Sale',
initial: 'place order',
context: {
retries: 0
},
states: {
'place order': {
on: {
'unpack qr': 'qrcode'
@wzulfikar
wzulfikar / machine.js
Last active July 25, 2019 08:51
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// Machine (machine factory function)
// assign (action)
// XState (all XState exports)
const fetchMachine = Machine({
id: 'Point of Sale',
context: { attempts: 0 },
initial: 'idle',

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

#!/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 October 23, 2018 08:22
shamir secret sharing demo in 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 August 26, 2021 17:51
Drone CI slack template. more on drone.io + slack integration: http://plugins.drone.io/drone-plugins/drone-slack/
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 November 19, 2017 04:25
Using parallel function and thread in 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) = {
@wzulfikar
wzulfikar / orderSummary.ts
Created November 14, 2017 18:08
Using TypeScript to create order summary.
/**
* Wed, 15 Nov 2017 at 0:56:13 MYT
* "Using TypeScript to create order summary."
*
* The purpose of this snippet is to demonstrate the
* use of TypeScript in our code.
* You can run this code online here:
* https://www.typescriptlang.org/play/
*
* PS:
@wzulfikar
wzulfikar / GetFbProfile.php
Created February 19, 2017 12:18
Get FB User Profile
<?php
/**
* fetch profile of given fb's user id. fields are optional.
*/
function getFbProfile($userId, array $fields = [])
{
$ACCESSS_TOKEN = 'YOUR_TOKEN_HERE';
$BASE_URL = 'https://graph.facebook.com/v2.6';
// fetch default fields if no fields passed