Skip to content

Instantly share code, notes, and snippets.

View Insolita's full-sized avatar
🤪

Insolita Insolita

🤪
View GitHub Profile
@Insolita
Insolita / keychron_linux.md
Created July 7, 2021 15:32 — forked from andrebrait/keychron_linux.md
Keychron keyboards on Linux (+ bluetooth fixes)

Here the best setup (I think so :D) for Keychron + Linux

Make Fn + F-keys work

  • Step 1: Set fkeyfirst by:
    • Create the file /etc/modprobe.d/hid_apple.conf. Add this line to the file: options hid_apple fnmode=2
    • Save the file and execute the following command: sudo update-initramfs -u
    • Reboot
  • Step 2: Use the keyboard in Windows/Android mode
  • Step 3: If get stuck with numpad mode: Double hit F6 or fn + F6. I've been using this config since the very first day, both bluetooth and cable with no problem.
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace app\commands;
use League\CLImate\CLImate;
@Insolita
Insolita / my.zsh-theme
Created March 19, 2019 18:56
my.zsh-theme
if [ $USER =='root']; then NCOLOR="red"; else NCOLOR="green"; fi
local RETCODE="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
local SYSICON UNAME PATHICON GITICON
() {
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
SYSICON=$'\uF17C';
PATHICON=$'\uF015';
GITICON=$'\uF113';
}
@Insolita
Insolita / PhpArrayExport.php.js
Last active October 20, 2023 13:49
JetBrains table export in php-array format
function eachWithIdx(iterable, f) {
var i = iterable.iterator();
var idx = 0;
while (i.hasNext()) f(i.next(), idx++);
}
function mapEach(iterable, f) {
var vs = [];
eachWithIdx(iterable, function (i) {
vs.push(f(i));
@Insolita
Insolita / DummyJob.php
Last active May 29, 2018 11:34
Task App Article
<?php
namespace App\Jobs;
class DummyJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private $params;
public function __construct(array $params = [])
{
$this->params = $params;
@Insolita
Insolita / Envoy.blade.php
Created April 9, 2018 11:35 — forked from michaeldyrynda/Envoy.blade.php
Laravel 5 Envoy deploy configuration
@servers([ 'remote' => 'server.example.com', ])
@setup
if ( ! isset($repo) )
{
throw new Exception('--repo must be specified');
}
if ( ! isset($base_dir) )
{
@Insolita
Insolita / firstvds_full.js
Created December 8, 2017 17:39
firstvds_full.js
let mind=(D)=>{
let my = D.john.position,nx = D.nexa.position,inf=D.infection;
storage.firstGoal = storage.firstGoal||0;
storage.nexa_catch=storage.nexa_catch||0;
let A = v => Math.abs(v);
let B = v => v.length;
let nearOneStep = (it) =>((my.x === it.x && nearNextRowY(it)) || (my.y === it.y && nearNextRowX(it)));
let nearNextRowY = (it) => (A(my.y-it.y)===1);
let nearNextRowX = (it) => (A(my.x-it.x)===1);
let directionByX = (x, y)=> (my.x !== x)? (my.x > x ? 'left' : 'right') :(my.y > y ? 'up' : 'down');
mind=d=>{S=storage,T=d.infection,U=d.john.position,V=d.nexa.position,S.f=S.f||0,S.n=S.n||0,l='left',r='right',u='up',w='down';A=v=>Math.abs(v);B=v=>v.length;C=v=>(U.x==v.x&&D(v))||(U.y==v.y&&E(v));D=v=>A(U.y-v.y)==1;E=v=>A(U.x-v.x)==1;F=(x,y)=>U.x!=x?(U.x>x?l:r):(U.y>y?u:w);G=(x,y)=>U.y!=y?(U.y>y?u:w):(U.x>x?l:r);H=()=>T.some(v=>U.x==v.x&&U.y==v.y);I=(x,y)=>(!J()&&!S.f)?G(x,y):F(x,y);J=()=>{if(U.x==V.x&&U.y==V.y){S.n+=1;}return(S.n>0);};K=()=>U.x==V.x;L=v=>v.reduce((r,t)=>(!B(r)?(r=T.filter(t), r):r),[]);M=v=>B(v)?v[0]:[];N=()=>T.reduce((m,t)=>{d=O(V,t);if(m.d<d){m.d=d;m.c=t;}return m;},{'d':0,'c':S.t});O=(v,t)=>A(v.x-t.x)+A(v.y-t.y);P=()=>{S.t=(!S.f?T[0]:(S.f&&!J()?V:(S.t&&V.y!=1?N().c:(Z=L([C,(v)=>(U.y==v.y),D]),B(Z)?M(Z):N().c))));return I(S.t.x,S.t.y)};Q=()=>H()&&!(!J()&&K())?(S.t=null,S.f=1,1):0;return Q()?'cure':P()}
@Insolita
Insolita / BaseFilterRequest.php
Last active April 23, 2019 12:37
Laravel grid
<?php
/**BaseRequest class for grid request **/
class BaseFilterRequest extends FormRequest
{
const SORT_ASC = 'asc';
const SORT_DESC = 'desc';
public static $sortable
= [
'id',
@Insolita
Insolita / MyTwiggedView.php
Last active May 31, 2017 18:33
MyTwiggedView
'view'=>[
'class'=>\yii\web\View::class,
'defaultExtension' => 'twig',
'renderers' => [
'twig'=>[
'class'=>\yii\twig\ViewRenderer::class,
'cachePath' => '@app/runtime/Twig/cache',
'options' => [
'auto_reload' => true,
],