Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Building stuff

Marcus Olsson olssonm

👨‍💻
Building stuff
View GitHub Profile
@olssonm
olssonm / sshproxy.sh
Last active Apr 7, 2021
SSH proxy with curl
View sshproxy.sh
# Enabling proxy
ssh -D 8080 -f -C -N username@server
# Tunnelling via proxy
curl -v --socks5-hostname 0:8080 icanhazip.com
# Killing process
ps -C ssh
kill {PID}
@olssonm
olssonm / stripe.sh
Created Feb 11, 2021
Local testing of Stripe webhooks for host-domains
View stripe.sh
stripe listen --forward-to 192.168.10.10:80/webhook/stripe --headers "host:hostdomain.test"
@olssonm
olssonm / pixelmator.sh
Created Dec 23, 2020
Set the scroll in Pixelmator Pro to be "Normal"
View pixelmator.sh
defaults write com.pixelmatorteam.pixelmator.x scrollToZoomDirectionInverted -bool true
@olssonm
olssonm / AppServiceProvider.php
Created Oct 30, 2020
Set localized time via Carbon in Laravel
View AppServiceProvider.php
<?php
public function register()
{
// Prefered method
\Carbon\Carbon::setUTF8(true);
\Carbon\Carbon::setLocale(config('app.locale'));
setlocale(LC_TIME, config('app.locale'));
// If a specific language-pack is installed/to be used
@olssonm
olssonm / available-domains-se-eng.txt
Last active Aug 14, 2022
List of available English one-word-domains with the .se TLD. Updated @ 2022-08-14 08:00.
View available-domains-se-eng.txt
understanding.se
literature.se
organization.se
month.se
audience.se
disease.se
population.se
category.se
association.se
importance.se
View pmset
# Check current values
pmset -g
# Set a pmset values (must be sudo)
pmset -a $key $value
# Scan the pmset log for sleep and wake reasons
pmset -g log|grep -e " Sleep " -e " Wake "
# Try to find reasons for keeping the Mac awake
@olssonm
olssonm / numbers-csv-parse.php
Created Nov 7, 2019
Quick way to parse a CSV-file exported from Apple Numbers (using default UTF-8 formatting).
View numbers-csv-parse.php
$data = array_map(function($v) {
return str_getcsv($v, ";");
}, file($file));
@olssonm
olssonm / ngrok.sh
Created Sep 5, 2019
Route ngrok to custom local host
View ngrok.sh
./ngrok http 192.168.10.10:80 --host-header=SITE
@olssonm
olssonm / import.php
Created Nov 6, 2018
Import a SQL-file/dump in Laravel
View import.php
<?php
use DB;
DB::unprepared(file_get_contents(storage_path('file.sql')));
@olssonm
olssonm / allowPaste.js
Created Sep 21, 2018
Enable paste on sites that blocks it
View allowPaste.js
var allowPaste = function(e){
e.stopImmediatePropagation();
return true;
};
document.addEventListener('paste', allowPaste, true);