Skip to content

Instantly share code, notes, and snippets.

View insane-dev's full-sized avatar
🎯
Focusing

Bogdan insane-dev

🎯
Focusing
View GitHub Profile
@insane-dev
insane-dev / make-subl-default-text-editor.sh
Created February 26, 2024 23:31
Change MacOS Sonoma default editor to Sublime 4
# Run in terminal
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.4;}'
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add '{LSHandlerContentType=public.data;LSHandlerRoleAll=com.sublimetext.4;}'
# IMPORTANT: You must restart your Mac for the changes to take effect.
@insane-dev
insane-dev / com.apple.launchservices.secure.plist
Last active April 13, 2023 12:28
Replace Text Edit with Sublime Text 4 (MacOS)
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.4;}'
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add '{LSHandlerContentType=public.data;LSHandlerRoleAll=com.sublimetext.4;}'
@insane-dev
insane-dev / compile-imagick.sh
Created July 6, 2021 10:21
Compile imagick on MacOS (php7.4-8)
// If you have installed PHP 8.0 on your MBP from brew you can simply build the Imagick from source:
git clone https://github.com/Imagick/imagick
cd imagick
phpize && ./configure
make
make install
// Builded extension should land in similarly directory:
@insane-dev
insane-dev / command.sh
Created September 22, 2020 21:07
Per-repository SSH keys
# If you want to use different keys depending on the repository you are working
# on, you can issue the following command while inside your repository:
git config core.sshCommand "ssh -o IdentitiesOnly=yes -i ~/.ssh/private-key-filename-for-this-repository -F /dev/null"
@insane-dev
insane-dev / .bash_aliases
Created July 9, 2017 15:02
Commonly used bash aliases
#!/bin/bash
# Colors
RED='\033[0;31m'
BLACK='\033[0;30m'
DARK_GRAY='\033[1;30m'
LIGHT_RED='\033[1;31m'
GREEN='\033[0;32m'
LIGHT_GREEN='\033[1;32m'
BROWN_ORANGE='\033[0;33m'
@insane-dev
insane-dev / mysql-timezone-set.cnf
Created April 27, 2017 20:16
Set timezone for MySQL
# Populate the Time Zone Tables from your system into the MySQL:
# @see https://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html#time-zone-installation
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
# In `/etc/mysql/my.cnf` add following line under [mysqld] config group:
[mysqld]
@insane-dev
insane-dev / Gruntfile.js
Last active June 14, 2016 22:26
bower.json, package.json and perfect starter Gruntfile.js (jade(pug), scss/sass, minifiers, ulifiers, cache busting, bower, image optimization, browser live reload, file concatenating)
// For performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// If you want to recursively match all sub-folders, use:
// 'test/spec/**/*.js'
'use strict';
module.exports = function (grunt) {
var autoprefixer = require('autoprefixer')({
@insane-dev
insane-dev / removedomain.sh
Created May 5, 2016 14:00
Command that removes domain dir and its nginx config
#!/bin/bash
# Removedomain command
# ---
# script can run with the domain as a command line input
# `sudo ./nginx_domain.sh my_domain.com` or without and
# the script will prompt the user for input
#
# BTW: You can make it global e.g. by:
# sudo ln -s /opt/delagics/removedomain.sh /usr/bin/removedomain
@insane-dev
insane-dev / makedomain.sh
Last active April 1, 2017 22:57
Command that creates domain dir and its nginx config
#!/bin/bash
# Makedomain command
# ---
# script can run with the domain as a command line input
# `sudo ./nginx_domain.sh my_domain.com` or without and
# the script will prompt the user for input
#
# BTW: You can make it global e.g. by:
# sudo ln -s /opt/delagics/makedomain.sh /usr/bin/makedomain
@insane-dev
insane-dev / install.sh
Last active December 8, 2019 16:09
Lemp stack for Ubuntu 16.04 (PHP7, Nginx, MySql, MongoDB, PhpMyAdmin, Git, Node.js, Bower, Gulp, Docker, Composer(with asset plugin), Dnsmasq)
#!/bin/bash
echo "Please, enter your username, it will be added to 'sudo' and 'docker' groups during the process."
read USERNAME
if [ -z "$USERNAME" ] ; then
echo "Exiting... Done."
exit
else
echo "Adding user to 'sudo' group..."