Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Hasan Basri hasanbasri1993

🏠
Working from home
View GitHub Profile
View openvpn.conf
ca /home/pi/openvpn/ca.cert
cert /home/pi/openvpn/client.cert
key /home/pi/openvpn/client.key
client
cipher BF-CBC
dev tun
persist-key
persist-tun
proto tcp
nobind
View gist:565c698c665aa63ec310dffcaa4c48dc
docker network create influxdb
docker run --rm telegraf telegraf config > telegraf.conf
docker run -d --restart always --name influxdb --net=influxdb -p 8086:8086 influxdb
docker run -d --restart always --name=telegraf --net=influxdb -v /Users/hasanbasri1/telegraf.conf:/etc/telegraf/telegraf.conf:ro telegraf
View gist:bb5785ca0e3cab73ddf5f2e8d161f45b
# Configuration for telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "1s"
## Rounds collection interval to 'interval'
## ie, if interval="10s" then always collect on :00, :10, :20, etc.
round_interval = true
## Telegraf will send metrics to outputs in batches of at most
## metric_batch_size metrics.
View tripay_create
function tripay_create($postData = false)
{
$order_items = [];
$post = $postData ? $postData : $this->request->getPost();
$apiKey = $this->apiKey;
$privateKey = $this->privateKey;
$merchantRef = $post['id_order'];
$amount = $post['biaya'] + 5000;
$method = $post['metode_bayar'];
if (isset($post['data']) and !isset($post['id_takhosus'])) {
@hasanbasri1993
hasanbasri1993 / unifi-backup.sh
Last active Nov 30, 2020 — forked from corny/unifi-backup.sh
Improved backup script for Ubiquiti UniFi controller
View unifi-backup.sh
#!/bin/bash -e
#
# Improved backup script for Ubiquiti UniFi controller
# original source: http://wiki.ubnt.com/UniFi#Automated_Backup
#
# must contain:
username=YOUR_USERNAME
password=YOUR_PASSWORD
@hasanbasri1993
hasanbasri1993 / read_float.js
Last active Nov 14, 2020
Membaca 32 bit Float Dari MODBUS Menggunakan NodeRed
View read_float.js
msg.payload = [0, 16833]; // hapus ini untuk melihat menkorvensi dari modbus
let pay = msg.payload; // mengambil data dari modbus
const buf = Buffer.allocUnsafe(4);
buf.writeInt16BE(pay[0],2);
buf.writeInt16BE(pay[1],0);
msg.payload = buf.readFloatBE(0);
return msg;
View blynk-macOs-media-control.js
#!/usr/bin/env node
const Blynk = require('blynk-library');
const applescript = require('applescript');
const AUTH = '';
const blynk = new Blynk.Blynk(AUTH);
const volume = new blynk.VirtualPin(0)
const play = new blynk.VirtualPin(1)
const next = new blynk.VirtualPin(2)
View ulang dan selesai
function selesaikan_ujian(id) {
swal({
title: 'Apa anda yakin?',
text: "aksi ini akan menyelesaikan secara paksa ujian yang sedang berlangsung!",
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes!'
}).then((result) => {
if (result.value) {
View selesai.php
<?php
require("config/config.default.php");
require("config/config.function.php");
require("config/functions.crud.php");
$idm = $_POST['id_mapel'];
$ids = $_POST['id_siswa'];
$idu = $_POST['id_ujian'];
$where = array(
'id_mapel' => $idm,
@hasanbasri1993
hasanbasri1993 / index.php
Created May 14, 2020
replace dengan ini
View index.php
let status_exam = $('#tablestatus').DataTable({
"serverSide": true,
"stateSave": true,
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "kabehlah"]],
"ajax": "<?= $homeurl ?>/admin/server_side_status.php?id=76310EEFF2B5D3C887F238976A421B638CFEB0942AB8249CD0A29B125C91B3E5"
});
setInterval(function () {
status_exam.ajax.reload();
}, 1000);