Skip to content

Instantly share code, notes, and snippets.

View abdumu's full-sized avatar
💭
are we even real? or just entities in a simulated environment ,,,

Abdulrahman ☕️ abdumu

💭
are we even real? or just entities in a simulated environment ,,,
View GitHub Profile
@abdumu
abdumu / config.fish
Created July 5, 2023 22:41
random quote in your terminal as welcome message from thousands of quotes, using php with fish
# 1 - you should install php in your system (apt-get install php)
# 2 - download (https://github.com/mubaris/motivate/blob/master/motivate/data_unique/unique_quotes.json)
# 3 - place unique_quotes.json in ~/.config/fish
# 4 - add the code below in your ~/.config/fish/config.fish
# 5 - enjoy.
function fish_greeting
php -r 'echo (function () { $a = json_decode(file_get_contents(\'/'$HOME'/.config/fish/unique_quotes.json\'), true)[\'data\']; $k = array_rand($a); return $a[$k][\'quote\']."\\n— ".$a[$k][\'author\']."\\n";})();';
end
@abdumu
abdumu / Caddyfile
Created May 11, 2022 00:07
Laravel caddy2, multiple websites on ubuntu custom domains : in /etc/caddy, and in /etc/caddy/snippets
{
debug
}
import snippets/*
#website 1
import laravel-app website.localhost /home/name/www/website
@abdumu
abdumu / check-server-services.sh
Last active April 23, 2022 15:18
check server services and notify you by email or webhook (slack+discord) if service is down and restart didnt work
#!/bin/bash
# check services status
# if that service is not running
# it will start the service and send an email/webhook to you
# if the restart does not work, it sends an email/webhook and then exits
# your email address / discord /slack webhook.
# one at least must be filled
# if we using discord, add "/slack" after webhook as in:
@abdumu
abdumu / Controller.php
Last active January 21, 2022 12:26
Helpers for Inertia and Laravel (translations, routes)
<?php
namespace App\Http\Controllers;
use Inertia\Inertia;
class AboutController extends Controller
{
public function __invoke()
{
@abdumu
abdumu / dwg.dxf.cad.app.linux.viewer.md
Last active August 8, 2023 20:41
Display large dwg on linux | DWG + CAD viewer linux
  1. Download de.caff viwer: https://caff.de/projects/caffviewer/

  2. Copy downloaned caffviewer.jar file to /home/YOUR-NAME/opt

  3. Create a desktop file /home/YOUR-NAME/.local/share/applications/decaff.desktop

  4. Open the created desktop file and paste this

[Desktop Entry]
@abdumu
abdumu / simpleNote2ZohoNoteBook.php
Created September 19, 2020 19:55
Convert simplenote to keep format to import into Zoho Notebook. [After exporting notes.zip, add this file inside the folder and run `php simpleNote2ZohoNoteBook.php`
<?php
mkdir('./Takeout');
mkdir('./Takeout/Keep');
if (!file_exists('./Takeout/Keep')) {
die('Please create empty "./Takeout/Keep" folder.');
}
$htmlTemplate = '<?xml version="1.0" ?>
@abdumu
abdumu / dark.mode.toggle.tailwindcss.alpine.html
Last active September 1, 2020 16:13
dark mode toggle using tailwindcss and alpine
<div class="relative inline-block w-12 select-none" x-data="{ toggle: false }"
@click.prevent="toggle = ! toggle">
<div :class="{'translate-x-full': toggle}"
class="absolute z-10 border-gray-800 block w-6 h-6 rounded-full bg-white border-4 cursor-pointer transition duration-500 transform"></div>
<div
class="overflow-hidden bg-gray-800 h-6 w-full rounded-full cursor-pointer flex justify-between items-center p-px">
<!-- feathericons -->
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-blue-300 fill-current" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="0" stroke-linecap="round" stroke-linejoin="round">
@abdumu
abdumu / fix_vscode.sh
Last active September 13, 2020 22:19
remove the sh***y actions icons & [unsupported] sh***y label from vscode
#!/bin/bash
os=${OSTYPE//[0-9.-]*/}
gistUrl="https://gist.githubusercontent.com/abdumu/8a8a5e7108dfdc572ed04c349347f36b/raw/workbench.desktop.main.css"
css=$(wget $gistUrl -q -O -)
case "$os" in
linux)
path="/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.css"
cp "$path" "$path.bk"
@abdumu
abdumu / volume.sh
Created July 2, 2020 22:09
Increase Linux audio volume to above 100% (160%) to match Windows volume boost.
#!/bin/bash
volume=$(pacmd list-sinks|grep -A 15 '* index'| awk '/volume: front/{ print $5 }' | sed 's/[%|,]//g')
command=$1;
percentage=$(( 160*20/100 ))
@abdumu
abdumu / git-merge-changes-of-path-from-another-branch.sh
Last active February 29, 2020 21:32
Get files from a range of commits from a different branch and merge them into your current branch
# Get files from a range of commits from a different branch
# and merge them into your current branch
#
# Imagine you are in `feature` branch, and you want
# get files [between range of commits] from `master` and merge them
# into `feature` branch.
$ git checkout master -- $(git diff --name-only SHA1 SHA1 --diff-filter=ACMRTUXB)