Skip to content

Instantly share code, notes, and snippets.

View mraubo's full-sized avatar

Mateusz Raubo mraubo

  • Olsztyn
View GitHub Profile

How to follow this guide

The problem

I have one computer and two different github accounts. One is for work, the other is for my personal stuff. I can't use the same ssh key twice, so I have to use different ssh key for each of my accounts. How do I do that? How do I switch between these ssh keys?

@mraubo
mraubo / mac-disk-condition.sh
Created July 7, 2021 10:31
mac disk smart
brew install smartmontools
diskutil list
smartctl -a disk0
@mraubo
mraubo / .htaccess
Created May 7, 2021 07:02
Rewrite Root to subfolder
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com$ [NC]
RewriteRule !^subdir/ /subdir%{REQUEST_URI} [L,NC]

For 4.x

  1. You may need install autoconf via brew install autoconf and brew install m4 and xcode-select --install.
  2. cd /Applications/MAMP/bin/php/php*.*.*/bin,
  3. execute ./pecl config-set php_ini /Applications/MAMP/bin/php/php7.4.12/conf/php.ini
  4. then./pecl install redis for default version or ./pecl install redis-3.1.2 for special version.
  5. Add extension="redis.so" to the end of php.ini (Open MAMP Pro dashboard, LANGUAGE-PHP,click 'Manually enable other extensions'), for non-pro users edit /Applications/MAMP/bin/php/php7.x.x/conf/php.ini (Channge 7.x.x to your PHP version)
  6. Restart MAMP.
@mraubo
mraubo / calcDiffrenceBetweenDates.js
Created March 26, 2021 13:25
Calculate diffrence in days between dates
const date1 = new Date("06/30/2019");
const date2 = new Date("07/30/2019");
// To calculate the time difference of two dates
const differenceInTime = date2.getTime() - date1.getTime();
// To calculate the no. of days between two dates
const differenceInDays = differenceInTime / (1000 * 3600 * 24);
@mraubo
mraubo / Install Composer to use MAMP's PHP.md
Last active March 26, 2021 15:40 — forked from kkirsche/Install Composer to use MAMP's PHP.md
How to install Composer globally using MAMP's PHP

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.zshrc

This will open nano with the contents, at the top in a blank line add the following line:

@mraubo
mraubo / remapKeys.bash
Created March 5, 2021 14:10
Remap MacOs Caps->Back, cmdr->optr, optr->cmdr
hidutil property --set '{"UserKeyMapping":[
{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x70000002A},
{"HIDKeyboardModifierMappingSrc":0x7000000E7,"HIDKeyboardModifierMappingDst":0x7000000E6},
{"HIDKeyboardModifierMappingSrc":0x7000000E6,"HIDKeyboardModifierMappingDst":0x7000000E7}
]}'

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@mraubo
mraubo / cherry-pick.sh
Created December 7, 2020 08:08
Cherry-pick from remote
# Cloning our fork
$ git clone git clone [email protected]:ifad/rest-client.git
# Adding (as "endel") the repo from we want to cherry-pick
$ git remote add endel git://github.com/endel/rest-client.git
# Fetch their branches
$ git fetch endel
# List their commits
@mraubo
mraubo / delete-merged-braches.zsh
Created November 6, 2020 10:28
[GIT] Delete merged local branches
# https://stevenharman.net/git-clean-delete-already-merged-branches
BRANCH_NAME=$1
$ git branch --merged BRANCH_NAME | grep -v "\* BRANCH_NAME" | xargs -n 1 git branch -d