Skip to content

Instantly share code, notes, and snippets.

@kaaquist
kaaquist / podman_macos.md
Last active April 2, 2024 13:20
Podman with docker-compose on MacOS.

Podman with docker-compose on MacOS.

Podman an alternative to Docker Desktop on MacOS

Getting podman installed and started is super easy.
Just use brew to install it.

> brew install podman

Now since podman uses a VM just like the Docker Client on MacOS we need to initialize that and start it.

@lyrixx
lyrixx / HardCoreDebugLogger.php
Last active April 19, 2024 13:47
Hardcore Debug Logger
<?php
const STREAM_OPEN_FOR_INCLUDE = 128;
final class HardCoreDebugLogger
{
public static function register(string $output = 'php://stdout')
{
register_tick_function(function () use ($output) {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
@sarthology
sarthology / regexCheatsheet.js
Created January 10, 2019 07:54
A regex cheatsheet 👩🏻‍💻 (by Catherine)
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active April 23, 2024 11:47
set -e, -u, -o, -x pipefail explanation
@nepsilon
nepsilon / how-to-output-a-range-of-lines-from-a-file.md
Created July 12, 2017 04:56
How to output a range of lines from a file? — First published in fullweb.io issue #107

How to output a range of lines from a file?

Easy enough with sed:

sed -n	123,230p filename

This will output filename content, from line 123 to line 230, inclusives. Notice the p letter after the last line number, this is what instruct sed to print to stdout.

@nepsilon
nepsilon / how-to-track-large-files-in-git.md
Created June 6, 2017 10:54
How to track large files (database, PSD, bin) in Git? — First published in fullweb.io issue #103

How to track large files (database, PSD, bin) in Git?

Sometimes you have PSD or a small-ish SQLite file you’d like to track with Git. The problem is Git is bad at tracking changes in big binary files by default. With Git Large File Storage (LFS) you can replace these large files with text pointers while storing the file contents on a remote server. Both GitHub and BitBucket support it. Here is how to get started:

1. Install Git LFS extension (Mac here):

brew install git-lfs
@nepsilon
nepsilon / how-to-secure-your-site-with-https.md
Last active August 9, 2018 11:19
How to secure your site with HTTPS? — First published in fullweb.io issue #101

How to secure your site with HTTPS?

With HTTP everything is visible when traveling on the Internet. By generating an SSL certificate and configuring your webserver you can force browsers to use HTTPS. Here is how to proceed:

# 1. Install letsencrypt
sudo pip install letsencrypt
@nepsilon
nepsilon / how-to-rename-a-branch-in-git.md
Last active December 5, 2018 17:24
How to rename a branch in Git? — First published in fullweb.io issue #96

How to rename a branch in Git?

Rename your local foo branch with bar:

git branch -m foo bar

Remember this will add the new branch with you push, but it won’t delete the old foo remote branch.

Add -f --mirror to rename the branch on the remote:

@nepsilon
nepsilon / 3-vim-tips-with-external-commands.md
Last active December 5, 2018 17:23
3 Vim tips with external commands — First published in fullweb.io issue #95

3 Vim tips with external commands

Vim has this ! special character that will run any shell command without having to close it. Here are 3 ways I often use it:

1. Format a JSON blob:

:%!python -m json.tool

2. Count number of characters in a file:

// ...
let webpack = require("webpack");
mix.webpackConfig({
plugins: [
// Choose the language you want to keep (Ex: "fr")
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /fr/)
]
});