Skip to content

Instantly share code, notes, and snippets.

View ryanhs's full-sized avatar

ryan hs ryanhs

  • PT Astra Internasional
  • Jakarta
View GitHub Profile
@ryanhs
ryanhs / mysqld.cnf
Created October 14, 2019 02:47
docker mysql NO_ZERO_IN_DATE disable
[mysqld]
sql_mode=ONLY_FULL_GROUP_BY,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
#log-error = /var/log/mysql/error.log
# By default we only accept connections from localhost
#bind-address = 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
@ryanhs
ryanhs / clear_cookie.js
Created June 21, 2019 02:57
Clear all cookies
@ryanhs
ryanhs / sh.sh
Created May 22, 2019 06:36
note about thingsboard docker
1. difference between array vs slice
1.a. mechanics of 'append'
docker run -d \
--name tbtest \
-p 9090:9090 \
--restart always \
thingsboard/tb
ACCESS TOKEN: Ukbj2ZHfxSVhEeEqENiW
@ryanhs
ryanhs / touchpad toggle ubuntu18.sh
Created May 5, 2019 04:44
touchpad toggle ubuntu 18
#!/bin/bash
STATUS=`gsettings get org.gnome.desktop.peripherals.touchpad send-events`
if [ "$STATUS" = "'enabled'" ]
then
gsettings set org.gnome.desktop.peripherals.touchpad send-events 'disabled'
else
gsettings set org.gnome.desktop.peripherals.touchpad send-events 'enabled'
fi
@ryanhs
ryanhs / terminator config
Created May 4, 2019 13:21
terminator config
[global_config]
suppress_multiple_term_dialog = True
title_receive_bg_color = "#729fcf"
title_transmit_bg_color = "#204a87"
[keybindings]
[layouts]
[[default]]
[[[child1]]]
parent = window0
profile = default
@ryanhs
ryanhs / .bashrc
Created February 20, 2019 02:40
.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@ryanhs
ryanhs / index.js
Created November 9, 2018 10:38
mssql from node
const sql = require('mssql')
const connstring = "mssql://wadezig:[email protected]/dbnamehere?encrypt=true"
const test = async function (context, req) {
let pool = await sql.connect(connstring)
let result = await pool.request()
.input('from', sql.VarChar(255), 'fromval')
.input('to', sql.VarChar(255), 'toval')
.query('insert into referrer (url_from, url_to) values (@from, @to)')
@ryanhs
ryanhs / laravel datatable cacher.php
Last active June 12, 2018 08:38
laravel datatable cacher
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class BrowseController extends Controller
{
// dattable cacher
@ryanhs
ryanhs / tele notif.sh
Created May 20, 2018 15:01
tele notif example
#!/bin/bash
notify() {
user_id=<your tele id>
bot_token=<your tele bot token>
message=$1
curl --data chat_id="${user_id}" \
--data "text=${message}" \
"https://api.telegram.org/bot${bot_token}/sendMessage"
}
@ryanhs
ryanhs / express.js
Last active May 5, 2018 17:29
Loki JS for big data, benchmark
const cluster = require('cluster');
const http = require('http');
const numCPUs = require('os').cpus().length;
const express = require('express');
const loki = require('lokijs');
var app = express();
var db = new loki('test');