Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Max mstaack

🎯
Focusing
View GitHub Profile
View NovaServiceProvider.php
<?php
namespace App\Providers;
use Laravel\Nova\Nova;
use Laravel\Nova\Cards\Help;
use Illuminate\Support\Facades\Gate;
use Laravel\Nova\NovaApplicationServiceProvider;
class NovaServiceProvider extends NovaApplicationServiceProvider
View proxy.php
$loop = React\EventLoop\Factory::create();
$server = new React\Http\Server($loop, function (Psr\Http\Message\ServerRequestInterface $request) use ($loop) {
$read = new React\Stream\ReadableResourceStream(fopen('source url', 'rb'), $loop);
$write = new WritableResourceStream(fopen('php://stdout', 'wb+'), $loop);
$read->pipe($write);
// return streamed response?!
});
@mstaack
mstaack / install.sh
Created Oct 12, 2020 — forked from yuvadm/install.sh
Arch Linux installation on Lenovo ThinkPad X200s
View install.sh
# Arch Linux installation procedure on a Lenovo ThinkPad X200s
# BIOS boot (no UEFI), SSD + LVM + LUKS + TRIM + discards
# Randomize (or zero) drive contents
dd if=/dev/urandom of=/dev/sda
# Create GPT and partitions
# Use gdisk to ensure proper partition alignment
gdisk /dev/sda
# 100MB boot partition on /dev/sda1 type 8300
View gist:5a523c8f82a2f3e33c670b8f720fbbe9
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "USBHost_t36.h"
#include "LoRa_E32.h"
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define HWSERIAL Serial1
View 2020_04_01_162532_fix_nova_table_for_mongo.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class FixNovaTableForMongo extends Migration
{
/**
* Run the migrations.
View 2020_03_31_155307_venue_indicies_migration.php
<?php
use App\Models\Mongo\Venue;
use Illuminate\Database\Migrations\Migration;
class VenueIndiciesMigration extends Migration
{
/**
* Run the migrations.
*
View MongodbServiceProvider.php
<?php
namespace App\Providers;
use Jenssegers\Mongodb\Connection;
use Jenssegers\Mongodb\Queue\MongoConnector;
class MongodbServiceProvider extends \Jenssegers\Mongodb\MongodbServiceProvider
{
/**
View mongo-php-pagination-with-facet
[
'$facet' => [
'data' => [
['$skip' => 30],
['$limit' => 30],
],
'total' => [
['$count' => 'count'],
]
]
View VenueController.php
$builder->where('rentables.prices', 'elemMatch', [
'type' => 'daily_rent',
'total_in_euro' => [
'$gte' => 60
],
]);
View php-node-setup.sh
#!/bin/bash
# Simple Server Setup Script
# M. Staack - 2020
set -e
# Base
sudo apt update
sudo apt upgrade -y
sudo apt-get install -y software-properties-common git curl zip unzip nginx glances htop nethogs