Skip to content

Instantly share code, notes, and snippets.

View wuriyanto48's full-sized avatar

wuriyanto wuriyanto48

View GitHub Profile
@wuriyanto48
wuriyanto48 / docker-compose.yml
Created November 10, 2022 05:23
Bull Nodejs example
version: '3'
services:
redis:
image: "redis:3.0-alpine"
command: redis-server --requirepass devpass
volumes:
- "./volumes/redis:/data"
ports:
- "6379:6379"
@wuriyanto48
wuriyanto48 / firebase-messaging-sw.js
Created September 30, 2022 13:32 — forked from loicginoux/firebase-messaging-sw.js
Adding FCM to an html page to receive notifications and sending then via FCM ruby gem. (edit: HTTPS needed!)
// [START initialize_firebase_in_sw]
// Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here, other Firebase libraries
// are not available in the service worker.
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-messaging.js');
// Initialize the Firebase app in the service worker by passing in the
// messagingSenderId.
firebase.initializeApp({
@wuriyanto48
wuriyanto48 / main.go
Created September 17, 2022 07:26
(Golang) Date of Birth simple Serialization with bitwise
// wuriyanto 2022
package main
import "fmt"
func main() {
var year uint32 = 1990
var month uint32 = 10
var day uint32 = 13
@wuriyanto48
wuriyanto48 / notest.md
Last active August 21, 2022 11:27
Mysql Column Level Encryption with AES
@wuriyanto48
wuriyanto48 / notest.md
Last active August 21, 2022 11:27
Postgresql Column Level Symmetric Encryption with PGCRYPTO
@wuriyanto48
wuriyanto48 / index.js
Last active September 20, 2022 08:25
Nodejs: Fetch Google Analytic data with googleapi module
const { google } = require('googleapis');
const fs = require('fs');
const analyticsreporting = google.analyticsreporting('v4');
const setAuth = () => {
// Obtain user credentials to use for the request
const auth = new google.auth.GoogleAuth({
keyFile: 'your_service_account.json',
scopes: ['https://www.googleapis.com/auth/analytics']
@wuriyanto48
wuriyanto48 / interval.js
Created July 26, 2022 06:03
Nodejs setInterval usage for delay execution
let sendStatus = 'FAILED';
// DELAY in Milliseconds
const DELAY = 1000; // 1 second
const retryEmail = () => {
console.log('retry failed email');
return 'FAILED';
};
@wuriyanto48
wuriyanto48 / Makefile
Created July 1, 2022 06:34
Scheduling Cron (Golang)
.PHONY : test build clean format
ALL_PACKAGES=$(shell go list ./... | grep -v "vendor")
test:
$(foreach pkg, $(ALL_PACKAGES),\
go test -race -short $(pkg);)
build:
@echo "building binary"
@wuriyanto48
wuriyanto48 / graphite_install.sh
Created June 10, 2022 03:37 — forked from amoslanka/graphite_install.sh
Install StatsD on an Ubuntu box, including creating an upstart service and the option to build a graphite box or configure Librato as a backend.
#
# Assumes an independent box (we'll call this one "graphite")
#
# Stay up to date
sudo apt-get update
sudo apt-get upgrade
# Install git
sudo apt-get install g++ curl libssl-dev -y
@wuriyanto48
wuriyanto48 / main.go
Last active October 23, 2022 18:02
Draw Circle to Console (implementation with Golang)
package main
import (
"bytes"
"fmt"
"math"
"strings"
)
// α(radians) = α(degrees) × π / 180°