Skip to content

Instantly share code, notes, and snippets.

View spacemudd's full-sized avatar
🎯
Focusing

Shafiq al-Shaar spacemudd

🎯
Focusing
View GitHub Profile
@spacemudd
spacemudd / DrcSwitchMiddleware.php
Created December 3, 2020 09:44
Middleware for automatic switch over of database host in Laravel
<?php
namespace App\Http\Middleware;
use Closure;
use Artisan;
use Log;
use DB;
class DrcSwitchMiddleware
@spacemudd
spacemudd / zoom-ar-language-key-value.json
Last active June 22, 2023 02:07
Zoom Web SDK translated files to Arabic
// by getShafiq.com.
{
"apac.same_as_system":"مثل النظام",
"apac.wc_joining_meeting":"الانضمام إلى الاجتماع ...",
"apac.wc_hostme":"(تستضيف لي)",
"apac.wc_me":"(أنا)",
"apac.wc_guest":"زائر",
"apac.wc_co_host":"(مضيف مشارك)",
"apac.wc_host":"(مضيف)",
@spacemudd
spacemudd / bzexcluderules_editable.xml
Created June 3, 2020 04:55
Backblaze - A personal exclude list for a web software developer.
<!-- This block are the optional Windows excludes the customer is allowed to edit -->
<excludefname_rule plat="win" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith=":\Users\" contains_1="ntuser.dat" contains_2="*" doesNotContain="*" endsWith=".txt.blf" hasFileExtension="blf" />
<excludefname_rule plat="win" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith=":\projects\vendor\" contains_1="*" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="win" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith=":\node_modules\" contains_1="*" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="win" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith=":\.PhpStorm2019.3\" contains_1="*" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="win" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith=":\projects\" contains_1="*" contains_2="*" doesNotContain="*"
@spacemudd
spacemudd / readme.md
Created April 15, 2020 17:05 — forked from jb510/readme.md
Exclude vcs (git, svn, hg) and node_modules from Backblaze backups on Mac

Backblaze's bztransmit process loads a file called bzfileids.dat into RAM. This file is a list of all files Backblaze has previously uploaded, including a unique identifier for each file. On most systems, this files is under 100MB in size (paraphrased from Backblaze support rep Zack).

Mine had grown to 6GB. This means that anytime bztransmit runs, it will load this 6GB file into RAM while it is backing up. In doing so it was purging massive ammounts of memory causing behavior like Chrome (usign 10GB of memory on it's own) to hang/beachball for 30 seconds and then refresh all it's windows.

There is no way to alter this behavior once it's begun, aside from starting over with some files excluded. The index needs to be rebuilt from scratch without the excessibe file count, that also means you can't restart and "inherit" a previous backup.

In my case the biggest culprits were .git and node_modules, so I excluded those, started a new backup (transfered licnese) and spent a week hunting for fast internet I could

@spacemudd
spacemudd / api.php
Last active October 30, 2018 21:34
Laravel Passport + Nuxt Auth
Route::post('auth/login', function(Request $request) {
$cred = $request->only('email', 'password');
if (auth()->attempt($cred)) {
auth()->user()->tokens()->delete();
$token = auth()->user()->createToken('SPA');
return response()->json([
'access_token' => $token->accessToken,
@spacemudd
spacemudd / 2017_09_05_184055_create_manufacturers_table.php
Last active December 23, 2017 02:16
Laravel and SQL Server 2012 DATETIME issue: PDOException: SQLSTATE[22007]
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateManufacturersTable extends Migration
{
/**
* Run the migrations.
@spacemudd
spacemudd / downloadBlob.js
Last active April 27, 2023 13:56
Blob downloading for Firefox / Chrome using VueJS / Axios
/*
* Blob is retrieved using an axios call and downloaded to the client side
* as if they were doing Right Click -> Save As.
* appendChild() and removeChild() are used because without them, downloading via FF doesn't work.
*
* Don't forget to give `{responseType: 'arraybuffer'}` as the third parameter if you're doing a POST request to fetch a file.
*
* @param blob Blob object (e.g. response.data from axios' callback)
* @param filename Filename of the file (taken from the content-headers of the call back or assigned at runtime)
*/