Skip to content

Instantly share code, notes, and snippets.

@mattbell87
mattbell87 / remote-wsl.md
Last active May 11, 2024 13:49
VSCode Remote: Connect to WSL2 from another machine

VSCode Remote: Connect to WSL2 from another machine

Do you want to do remote development on your WSL2 container in Visual Studio Code? Read this.

Proxy jump method

  1. On the host set up OpenSSH for Windows
  2. Run wsl --update to make sure you are running the latest WSL
  3. Open WSL and install another SSH server inside WSL with sudo apt-get install openssh-server
  4. Now run sudo systemctl enable --now ssh to automatically start ssh when WSL starts.
@markhowellsmead
markhowellsmead / event_query.php
Last active May 11, 2024 13:49
Complex WordPress meta query by start and end date (custom meta fields)
<?php
/**
* Complex WordPress meta query by start and end date (custom meta fields)
* Intended for use on the `pre_get_posts` hook.
* Caution; this makes the query very slow - several seconds - so should be
* implemented with some form of caching.
*
* mark@sayhello.ch 22.10.2019, based on code from 201 onwards
*/
@stevebauman
stevebauman / RouteServiceProvider.php
Last active May 11, 2024 13:47
Throw exception on Eloquent model binding name mismatch
<?php
namespaced App\Providers;
use RuntimeException;
use Illuminate\Support\Facades\Route;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Routing\ImplicitRouteBinding;
class RouteServiceProvider extends ServiceProvider
@flaksp
flaksp / README.md
Last active May 11, 2024 13:47
Convert BitWarden JSON export file to Apple iCloud Keychain CSV import file saving TOTP and notes

BitWarden to Apple iCloud Keychain passwords converter

This Python scripts allows you to move your passwords from BitWarden to Apple iCloud.

You need to know:

  • It ignores secure notes, credit cards and other types that are not passwords.
  • It ignores BitWarden entries without usernames, passwords and URLs.
  • It also ignores URLs that do not start with http:// or https://.
  • It normalizes all TOTP tokens, e.g. wskg vtqa h5kl bhb4 v4v2 ybyo woc6 qme2 will be converted to otpauth://totp/example.com:dude@foo.bar?secret=WSKGVTQAH5KLBHB4V4V2YBYOWOC6QME2&amp;issuer=example.com&amp;algorithm=SHA1&amp;digits=6&amp;period=30.
@inchoate
inchoate / readme.md
Last active May 11, 2024 13:46
Open clicked URLs into a particular Google Chrome profile

Problem

When I click on links from Slack or Outlook on MacOS they open in seemingly random browser windows/profiles. This is annoying.

Solution

Open links in a particular google chrome profile window. Be less annoyed.

  1. In Chrome, visit chrome://version and find the desired profile name. Mine was Default. Copy that profile's directory name, like Profile 2 or Default, not the profile's vanity name you see when you click on your profile icon in the browser.
  2. Install Finicky: brew install finicky. After install it should be running and you should see the icon in the upper toolbar.
  3. From the Finicky Toolbar Item, click > Config > Create New
  4. Edit the new file ~/.finicky and make it look something like this, filling in your profile name:
@Koshimizu-Takehito
Koshimizu-Takehito / ContentView.swift
Created May 11, 2024 09:59
グラデーションアニメーション
import SwiftUI
extension [Color] {
static func rainbow(hue: Double = 0, count: Int) -> Self {
(0..<count).map { i in
var value = hue + Double(i) / Double(count)
value -= floor(value)
return Color(hue: value, saturation: 1/4, brightness: 1)
}
}
@taylorrf
taylorrf / ActionVerbsListResumes.md
Created June 24, 2017 20:25
Action Verb List for Resumes & Cover Letters

Credits: ~ From The Damn Good Resume Guide by Yana Parker, Berkeley: Ten Speed Press ~

Management Skills

  • administered
  • analyzed
  • assigned
  • attained
  • chaired
@e7d
e7d / sample.sh
Last active May 11, 2024 13:46
Bash "try catch"
#!/bin/bash
export AnException=100
export AnotherException=101
# start with a try
try
( # open a subshell !!!
echo "do something"
[ someErrorCondition ] && throw $AnException

Disable Device Enrollment Notification on Mac.md

Restart the Mac in Recovery Mode by holding Comment-R during restart

Open Terminal in the recovery screen and type

csrutil disable
#!/bin/bash
iatest=$(expr index "$-" i)
#######################################################
# SOURCED ALIAS'S AND SCRIPTS BY zachbrowne.me
#######################################################
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc