Skip to content

Instantly share code, notes, and snippets.

View srdjanmarjanovic's full-sized avatar

Srdjan Marjanovic srdjanmarjanovic

View GitHub Profile
@srdjanmarjanovic
srdjanmarjanovic / nginx.conf
Created September 24, 2022 18:32 — forked from mreschke/nginx.conf
Nginx config for multiple laravel sites based on /api/v1 url paths
# This config will host your main [Laravel] GUI application at /, and any additional [Lumen] webservices at /api/v1 and /api/v2...
# This also works perfectly for all static file content in all projects
# This is full of debug comments so you can see how to print debug output to browser! Took me hours to nail this perfect config.
# Example:
# http://example.com - Main Laravel site as usual
# http://example.com/about - Main Laravel site about page as usual
# http://example.com/robots.txt - Main Laravel site static content as usual
# http://example.com/api/v1 - Lumen v1 api default / route
# http://example.com/api/v1/ - Lumen v1 api default / route
@srdjanmarjanovic
srdjanmarjanovic / Envoy.blade.php
Created March 19, 2021 07:50 — forked from gvsrepins/Envoy.blade.php
A Laravel envoy script for deployment
@servers(['production' => 'productionserver', 'local'=> 'vagrant@127.0.0.1 -p 2222'])
{{-- Configuration section --}}
@setup
/*
|--------------------------------------------------------------------------
| Git Config
|--------------------------------------------------------------------------
|
@srdjanmarjanovic
srdjanmarjanovic / ILI9341_1.ino
Created December 3, 2020 13:41 — forked from calogerus/ILI9341_1.ino
Arduino UNO + 2.4 TFT-LCD-Display-Shield-Touch-Panel-ILI9341-240x320-for-Arduino-UNO-MEGA
void LCD_write(uint8_t d) {
// ILI9341 reads data pins when WR rises from LOW to HIGH (A1 pin on arduino)
PORTC = PORTC & B11111101; // WR 0
// data pins of ILI9341 connected to two arduino ports
PORTD = (PORTD & B00000011) | ((d) & B11111100);
PORTB = (PORTB & B11111100) | ((d) & B00000011);
PORTC = PORTC | B00000010; // WR 1
}
@srdjanmarjanovic
srdjanmarjanovic / ubuntu-raid.sh
Created February 16, 2020 18:20 — forked from umpirsky/ubuntu-raid.sh
Install Ubuntu on RAID 0 and UEFI/GPT system
# http://askubuntu.com/questions/505446/how-to-install-ubuntu-14-04-with-raid-1-using-desktop-installer
# http://askubuntu.com/questions/660023/how-to-install-ubuntu-14-04-64-bit-with-a-dual-boot-raid-1-partition-on-an-uefi%5D
sudo -s
apt-get -y install mdadm
apt-get -y install grub-efi-amd64
sgdisk -z /dev/sda
sgdisk -z /dev/sdb
sgdisk -n 1:0:+100M -t 1:ef00 -c 1:"EFI System" /dev/sda
sgdisk -n 2:0:+8G -t 2:fd00 -c 2:"Linux RAID" /dev/sda
@srdjanmarjanovic
srdjanmarjanovic / ffmpeg-web-video-guide.md
Created April 10, 2019 15:14 — forked from jaydenseric/ffmpeg-web-video-guide.md
A quick guide to using FFmpeg to create cross-device web videos.

Video conversion with FFmpeg

Install

On mac:

  1. Download the latest release.
  2. Extract the binary and place it in /usr/local/bin.

Command basics

@srdjanmarjanovic
srdjanmarjanovic / FinalClass.php
Created April 10, 2019 10:24 — forked from DragonBe/FinalClass.php
Testing final classes is tricky, but possible even though you cannot directly mock a "final" class
<?php
namespace FinalClass;
require_once __DIR__ . '/vendor/autoload.php';
use PHPUnit\Framework\TestCase;
final class Foo
{
protected $bar;
@srdjanmarjanovic
srdjanmarjanovic / example.git
Created February 12, 2019 17:51 — forked from b-b3rn4rd/example.git
Moving pushed commit from one branch to another
// moving 71b8026 from features/project-part-2 to features/project-part-1
git checkout features/project-part-2
git revert 71b8026
// for sanity check can run git diff to between branched for particular file(s)
git difftool features/project-part-2..features/project-part-1 -- ./website/app/controllers/ExampleController.php
git push origin features/project-part-2
git checkout features/project-part-1
git cherry-pick 71b8026
@srdjanmarjanovic
srdjanmarjanovic / AbstractFoo.php
Created May 24, 2018 07:25 — forked from pjdietz/cloudSettings
Testing Protected Method of Abstract Class with PHPUnit
<?php
namespace Minitest;
abstract class AbstractFoo
{
protected function bar()
{
return $this->baz();
}
@srdjanmarjanovic
srdjanmarjanovic / dbtest.php
Created April 20, 2018 20:52 — forked from johnlane/dbtest.php
PHP SQLite test script
<?php //origin: http://www.if-not-true-then-false.com/2012/php-pdo-sqlite3-example/
// Kludges
const SQLITE3_TEXT = PDO::PARAM_STR;
const SQLITE3_INTEGER = PDO::PARAM_INT;
// Set default timezone
date_default_timezone_set('UTC');
try {
@srdjanmarjanovic
srdjanmarjanovic / curl-verbose.php
Created August 31, 2017 07:31 — forked from hubgit/curl-verbose.php
Verbose cURL in PHP
<?php
// Request URL
$url = 'http://www.google.com/';
// HTTP headers
$headers = array(
//'Content-Type: application/json',
//'Accept: application/json',
);