Skip to content

Instantly share code, notes, and snippets.

View dikotiledon's full-sized avatar

Riandi Kartiko dikotiledon

View GitHub Profile
Activate debug mode in Android
Connect to PC via USB
Open command prompt type: adb tcpip 5555
Disconnect your tablet or smartphone from pc
Open command prompt type: adb connect IPADDRESS (IPADDRESS is the DHCP/IP address of your tablet or smartphone, which you can find by Wi-Fi -> current connected network)
# Buttery powered state
adb shell dumpsys battery | grep powered
# Unplug battery
adb shell dumpsys battery unplug
# Reset battery
adb shell dumpsys battery reset
# Dump Doze mode info
@dikotiledon
dikotiledon / laravel_horizon.md
Created July 21, 2022 16:29 — forked from ankurk91/laravel_horizon.md
Laravel Horizon, redis-server, supervisord on Ubuntu 20 server

Laravel Horizon, redis-server, supervisord on Ubuntu server

Laravel 8+, Horizon 5.x, Redis 6.x

Parepare application

  • Install and configure Laravel Horizon as instructed in docs
  • Make sure you can access the Horizon dashboard like - http://yourapp.com/horizon
  • For now it should show status as inactive on dashbaord

Install redis-server

@dikotiledon
dikotiledon / autossh
Last active June 6, 2022 20:34
autossh multiple tunnels
# Source function library
. /etc/init.d/functions
RETVAL=0
prog="autossh"
autossh="/usr/bin/autossh"
[ ! -d /var/run/$prog ] && mkdir -p /var/run/$prog
start() {
@dikotiledon
dikotiledon / default.txt
Last active June 3, 2022 06:49
laravel with nginx in subdirectory
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.php;
server_name _;
@dikotiledon
dikotiledon / .htaccess
Created April 8, 2022 20:57 — forked from peruukki/.htaccess
Redirect traffic silently to a subdirectory under Apache document root
# Problem:
# You want to serve two sites, example1.com and example2.com, but your hosting service doesn't support
# virtual hosts, so you need to use the same document root for both of them. Or you just need to redirect
# traffic to a certain URL to a subdirectory under the document root.
#
# Solution:
# Put your site/files in a subdirectory under the document root and redirect the traffic there behind the scenes.
# Below is an example configuration for the URL example1.com and the subdirectory "example1".
#
@dikotiledon
dikotiledon / BCA_API.php
Created December 19, 2021 19:47 — forked from dertajora/BCA_API.php
This is my code when learn to use BCA API for my office. This code only works on Sandbox environment and there is no confidential information here. FYI, based on my experience if you want to implement this code using real environment of BCA API, you need to do some UAT with BCA side.
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class BCAAPI extends MY_Controller {
function __construct(){
$this->api_key = "YOUR API KEY";
$this->api_secret = "YOUR API SECRET";
$this->client_id = "YOUR CLIENT ID";
-- listen for console connection with the given secret key
-- controlSocket("0.0.0.0")
-- setKey(please generate a fresh private key with makeKey())

-- start the web server on port 8083, using password 'set a random password here'
-- webserver("0.0.0.0:8083", "set a random password here")

-- accept DNS queries on UDP/5200 and TCP/5200
@dikotiledon
dikotiledon / zerotier-rpi-bridge.md
Created July 4, 2020 11:04 — forked from laduke/zerotier-rpi-bridge.md
Various Network Configuration Output

Motivation

Use a Raspberry Pi as a bridge into my home LAN. The pi is plugged into a switch, which is plugged into an airport express, which is plugged into a cable modem; Nothing fancy.

This isn't a tutorial. Just some example output from a working setup.

steps

off the top of my head, here's the order I would do it in:

  • make sure plain old device to device zerotier is working with my LAN/Router/Firewall/ISP