Skip to content

Instantly share code, notes, and snippets.

View guangrei's full-sized avatar
💭
I may be slow to respond.

Am K guangrei

💭
I may be slow to respond.
View GitHub Profile
@guangrei
guangrei / holiday.go
Last active December 24, 2023 08:04
pengecekan hari libur dengan golang dan api hari libur v2
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func holiday(date string) (string, error) {
@guangrei
guangrei / change_db_password.py
Created September 15, 2023 02:15
script untuk mengganti password pada MariaDB
# -*-coding:utf8;-*-
import subprocess
"""
script untuk mengubah password MariaDB pada xampp docker.
ganti root@123 dengan password yang diinginkan dan tidak mudah ditebak!
author: guangrei
"""
@guangrei
guangrei / q.lua
Created February 20, 2022 12:39
Qlua Helper
--[[this is simple script to help interpreted .lua file directly, run luarocks and luarocks admin in Qlua.
author: guangrei
--]]
require "android"
c = android.dialogGetInput("Qlua Helper!", "Please Choice:\n1.interpreted .lua file directly\n2.run luarocks command\n3.run luarocks-admin command")
command = {"/data/data/com.quseit.qlua5pro2/files/bin/lua5","/data/data/com.quseit.qlua5pro2/files/bin/lua5 /data/data/com.quseit.qlua5pro2/files/bin/luarocks","/data/data/com.quseit.qlua5pro2/files/bin/lua5 /data/data/com.quseit.qlua5pro2/files/bin/luarocks-admin"}
if tonumber(c.result) == 1
then
i = android.dialogGetInput("Qlua Helper!", "please enter .lua file location")
else
#!/bin/bash
KEYS=$1
CMDS=$2
if [ $# -eq 0 ] ; then
echo "No arguments supplied"
echo "Usage: command KEY CMD"
exit 1
fi
@guangrei
guangrei / upload.sh
Last active February 8, 2021 09:07
bash upload
curl https://bashupload.com/grei/file.zip --data-binary @file.zip
@guangrei
guangrei / server.py
Last active January 1, 2021 07:14
python web tanpa framework
from http.server import BaseHTTPRequestHandler
from urllib import parse
from http.server import HTTPServer
class GetHandler(BaseHTTPRequestHandler):
def do_GET(self):
parsed_path = parse.urlparse(self.path)
res = """
@guangrei
guangrei / str_replace_word.php
Created November 22, 2020 10:09
php word replace , online demo https://ideone.com/94EjGy
<?php
function str_replace_word($cari, $ganti, $kalimat)
{
$cek = strpos($kalimat, " ");
if ($cek != false) {
$token = explode(" ", $kalimat);
$map = array_map(function($val) use ($cari, $ganti)
{
return $val === $cari ? $ganti : $val;
@guangrei
guangrei / .bashrc
Created December 28, 2018 13:00
c9.io ~/.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
. /etc/apache2/envvars
# If not running interactively, don't do anything else
[ -z "$PS1" ] && return
# don't put duplicate lines or lines starting with space in the history.
@guangrei
guangrei / localtunnel.sh
Created November 14, 2018 16:05
localtunnel.me auto reconnect
#!/bin/bash
DOMAIN=$1
PORT=$2
if [ $# -eq 0 ] ; then
echo "No arguments supplied"
echo "Usage: command DOMAIN PORT"
exit 1
fi
@guangrei
guangrei / fixJson.php
Created November 7, 2018 14:54
fix json on iis response
<?php
use Clue\React\Buzz\Browser;
use Psr\Http\Message\ResponseInterface;
require "vendor/autoload.php";
$url = "http://jendela.data.kemdikbud.go.id/api/index.php/cwilayah/wilayahKabGet";
$loop = React\EventLoop\Factory::create();
$browser = new Browser($loop);
$browser->get($url)->then(