Skip to content

Instantly share code, notes, and snippets.

@dhh
dhh / linux-setup.sh
Last active July 19, 2024 07:52
linux-setup.sh
# THIS LINUX SETUP SCRIPT HAS MORPHED INTO A WHOLE PROJECT: HTTPS://OMAKUB.ORG
# PLEASE CHECKOUT THAT PROJECT INSTEAD OF THIS OUTDATED SETUP SCRIPT.
#
#
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
@vuon9
vuon9 / README.md
Last active July 19, 2024 04:29
Powertoys - Keyboard Manager - Common macOS keys mapping

How to install

  • cd C:\Users\${username}\AppData\Local\Microsoft\PowerToys\Keyboard Manager
  • Backup file existing one of default.json
  • Download default.json and add it to the current folder

Mapped keys

key
Esc
@mhucka
mhucka / gist:59e785a315d813d14cd0258b89a2fcac
Last active February 2, 2024 22:28
Stop the Adobe Creative Cloud app from auto-launching on login on macOS
#!/bin/bash
# =============================================================================
# @file GitHub gist
# @brief stop Adobe Creative Cloud app from auto-launching on login on macOS
# @author Michael Hucka <mhucka@caltech.edu>
# @created 2021-08-12
# @website https://gist.github.com/mhucka/59e785a315d813d14cd0258b89a2fcac
#
# I find Adobe Creative Cloud absolutely infuriating. It installs auto
# launchers that are not in the user's login app list, and the services are
@diachedelic
diachedelic / deep-link-from-browser.js
Last active July 5, 2024 15:09
Deep link to a native app from a browser, with a fallback
@JohnnyWalkerDigital
JohnnyWalkerDigital / laravel-password-reset.md
Last active August 31, 2021 07:21
Laravel: Fix password reset (User email not sent)

Here's how to overcome this common gotcha: The default password reset system not working out of the box with Laravel 5.x (as you're not sent the user's password), without having to alter altering vendor/core. Here's how to make it work as you'd expect it to without changing any vendor files.

1. Create own notification

Firstly create a new notification for your app:

php artisan make:notification ResetPassword

Then open the newly created file: app\Notifications\ResetPassword.php and make the following changes:

@BenSampo
BenSampo / deploy.sh
Last active July 16, 2024 07:53
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@paulredmond
paulredmond / ValidateMailgunWebhook.php
Created April 24, 2017 21:55
Laravel Middleware to Validate a signed Mailgun webhook
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
/**
* Validate Mailgun Webhooks
* @see https://documentation.mailgun.com/user_manual.html#securing-webhooks
@pdtyreus
pdtyreus / SlackPostMessageWithAttachments.js
Created September 8, 2016 22:15
Slack chat.postMessage with attachments
var http = require("https");
var querystring = require('querystring');
//2 attachments as JavaScript Objects
var attachments = [{
fallback: "Attachment 1 Fallback",
title: "This is Attachment 1",
text: "Attachment 1 Text",
color: "#3964db"
}, {
@daronco
daronco / letsencrypt-webroot-apache.md
Last active February 15, 2024 11:50
Letsencrypt with webroot on Apache

Config Apache with /etc/apache2/conf-available/le.conf:

Alias /.well-known/acme-challenge/ "/var/www/html/.well-known/acme-challenge/"
<Directory "/var/www/html/">
    AllowOverride None
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>
@tomredman
tomredman / explicit.java
Last active April 13, 2016 13:56
Code Principle Example: "Explicit is better than Implicit"
/**
* You've probably heard it before, "explicit is better than implicit". Here's a simple
* example of that principle in action.
*
* In this example, our app has only two Fragments that can be visible at any given
* moment: CreateFragment and TrendingFragment. Both examples achieve the same result
* when everything is working as expected, however...
*
* In the explicit example, a final else{} branch would indiciate something's not
* quite right with our code somewhere since we know there are only two possible