Skip to content

Instantly share code, notes, and snippets.

@nepsilon
nepsilon / how-to-update-a-github-forked-repository.md
Created March 14, 2017 17:19
How to update a GitHub forked repository? — First published in fullweb.io issue #91

How to update a GitHub forked repository?

So you hit "Fork" and now you have this repo copy on your Github account. Here is what to do to keep it up-to-date with the original repo.

1. Add the original repo as remote, here called upstream:

git remote add upstream https://github.com/author/repo.git

2. Fetch all the branches of that upstream remote:

@nepsilon
nepsilon / a-better-setup-for-git.md
Last active October 19, 2020 19:15
A better setup for Git — First published in fullweb.io issue #46

A better setup for Git

Git default configuration is good but it can be personalized to improve your workflow efficiency. Here are some good lines to put in your ~/.gitconfig:

# The basics, who you commit as:
[user]
  name = John Doe
  email = john@doe.org
@nepsilon
nepsilon / how-to-split-a-file-into-smaller-chunks.md
Last active July 16, 2021 10:34
How to split a file into smaller chunks? — First published in fullweb.io issue #90

How to split a file into smaller chunks?

You may want to upload a 100GB file over an unstable network, or feed your scripts smaller inputs to load in RAM. In both cases, just splitting your file into smaller chunks is an easy solution.

Great news is Unix/Linux systems have the split utility already installed. And using it is simple as pie:

Cut a binary file into chunks of X bytes:

split -b X bigfile.avi
@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.

@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"
@pascalduez
pascalduez / SassMeister-input.scss
Last active December 20, 2023 20:38
Some Sass string functions: capitalize, ucwords, camelize, ...
// ----
// Sass (v3.3.4)
// Compass (v1.0.0.alpha.18)
// ----
// Capitalize string
// --------------------------------------------------------------------------------
// @param [string] $string
// --------------------------------------------------------------------------------
// @return [string]
@davidbalbert
davidbalbert / gist:6815258
Last active February 29, 2024 16:12
How to install custom SSL certificates on an ASUS RT-N66U running asuswrt-merlin
###########################################
# IMPORTANT NOTE:
#
# As of asuswrt-merlin 380.67 Beta, you
# can now configure SSL certificates from
# the Webui, making these instructions
# unnecessary.
###########################################
@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 / git-change-commit-messages.md
Last active April 24, 2024 06:30
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

@lyrixx
lyrixx / HardCoreDebugLogger.php
Last active April 27, 2024 14:09
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);