Skip to content

Instantly share code, notes, and snippets.

View johnroyer's full-sized avatar

Zero Huang johnroyer

View GitHub Profile
@johnroyer
johnroyer / scriptsafe-settings-2019-10
Last active November 11, 2019 05:14
ScriptSafe white list
webbugs|true
gamepad|false
syncnotify|true
fpWebGL|[]
useragentspoof|off
syncfromnotify|true
fpBattery|[]
frame|true
fpBluetooth|[]
uaspoofallow|false
@johnroyer
johnroyer / mysql.cnf
Last active July 30, 2019 13:46
MySQL 8.0 config
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
default-authentication-plugin = mysql_native_password
@johnroyer
johnroyer / php-info.log
Created September 25, 2019 07:20
PHP segment fault, ENV dump
feature/controller-shipping-refactor
027d43e6f1ddb261cb0021695af6bca42a73a9c0 is the first bad commit
commit 027d43e6f1ddb261cb0021695af6bca42a73a9c0
Author: Zero <john.royer@gmail.com>
Date: Mon Sep 23 10:14:43 2019 +0800
Catch exception from SplitShipmentService
app/Http/Controllers/ApiShipmentController.php | 6 +++++-
@johnroyer
johnroyer / main.js
Last active May 31, 2024 07:58
try to new Pin object on webduino
var webduino = require('webduino-js');
board = new webduino.WebArduino('Ge8pn');
board.on('ready', function (board) {
var pin = new webduino.core.Pin(board, 10, Pin.DOUT);
board.systemReset();
board.samplingInterval = 250;
var replay = new webduino.module.Relay(board, 10);
@import url(../../../stylesheets/application.css);
/* A1 theme version 2.0.0 by Kirill Bezrukov www.redmineup.com */
#header {
background: #394956;
min-height: 5em;
padding: 0px;
min-height: initial;
@johnroyer
johnroyer / getIp.php
Created June 8, 2021 05:03
get user IP
<?php
function getServerKey(string $key): string
{
if (array_key_exists($key, $_SERVER)) {
return $_SERVER[$key];
}
return '';
}
$orderedKey = [
@johnroyer
johnroyer / Sitemap.php
Last active February 17, 2022 06:17
Sitemap Middleware for Laravel
<?php
/**
* This file is orginzed from @FDisk from StackOverflow
* @see https://stackoverflow.com/a/28608156/8681141
*/
namespace App\Http\Middleware;
use Closure;
@johnroyer
johnroyer / PHPStorm-Darcula-customized.icls
Created February 18, 2022 13:43
Jetbrains IDE syntax highlight scheme without italic
<scheme name="Darcula" version="142" parent_scheme="Darcula">
<metaInfo>
<property name="created">2022-02-18T21:35:09</property>
<property name="ide">PhpStorm</property>
<property name="ideVersion">2021.3.2.0.0</property>
<property name="modified">2022-02-18T21:35:29</property>
<property name="originalScheme">_@user_Darcula</property>
</metaInfo>
<attributes>
<option name="DEFAULT_DOC_COMMENT">
@johnroyer
johnroyer / CustomHeaderRequestTrait.php
Created February 23, 2022 06:59
Customize HTTP header in Lumen unit test
<?php
use Illuminate\Testing\TestResponse;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
trait ApiTokenRequestTrait
{
public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null, $headers = [])
{
$symfonyRequest = SymfonyRequest::create(
@johnroyer
johnroyer / linodecreate
Last active March 13, 2022 13:50
Automatically create multiple node via linode-cli
#!/usr/bin/env bash
# usage:
# linodecreate NUM
#
# NUM is the number of node you want to create
genpassword() {
PASS=$( tr -dc A-Za-z0-9 </dev/urandom | head -c 5 | tr '[:upper:]' '[:lower:]' )
echo -n "prefix-$PASS"