Skip to content

Instantly share code, notes, and snippets.

@handleman
handleman / bash.sh
Created March 5, 2019 08:02
point bash output to file . How do I save terminal output to a file?
#Yes it is possible, just redirect the output to a file:
SomeCommand > SomeFile.txt
#Or if you want to append data:
SomeCommand >> SomeFile.txt
#If you want stderr as well use this:
SomeCommand &> SomeFile.txt
#or this to append:
@handleman
handleman / bash.sh
Created March 5, 2019 08:02
point bash output to file . How do I save terminal output to a file?
#Yes it is possible, just redirect the output to a file:
SomeCommand > SomeFile.txt
#Or if you want to append data:
SomeCommand >> SomeFile.txt
#If you want stderr as well use this:
SomeCommand &> SomeFile.txt
#or this to append:
@handleman
handleman / bash.sh
Created March 5, 2019 08:02
point bash output to file . How do I save terminal output to a file?
#Yes it is possible, just redirect the output to a file:
SomeCommand > SomeFile.txt
#Or if you want to append data:
SomeCommand >> SomeFile.txt
#If you want stderr as well use this:
SomeCommand &> SomeFile.txt
#or this to append:
@handleman
handleman / set.js
Created December 28, 2018 15:26
mathematical set implementation in javascript
function Set(items) {
var set = {};
for (var i = 0; i < items.length; i++) {
set[items[i]] = true;
}
return set;
}
function copyInto(s, copy) {
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@handleman
handleman / kill.bash
Created December 4, 2018 14:22
how to find and kill process on some port in MacOs and Linux
#3000 - port number needs to be unclocked
# common way
netstat -vanp tcp | grep 3000
# macOs
sudo lsof -i tcp:3000
#centOs
netstat -vanp --tcp | grep 3000
#after finding PID number of process
#run the following command:
@handleman
handleman / package.json
Last active December 3, 2018 13:32
How to execute several commands in one alias inside package.json . How to set environment variables inside package.json. Several commands in one in package json.
{
"scripts": {
"start": "webpack --config webpack.prod.js && node prod-server",
"dev": "export NODE_ENV='development' && export API_HOSTNAME='http://api.localhost:8000'"
}
}
@handleman
handleman / beautiful git log.bash
Created November 6, 2018 14:07
Pretty git log in one line
$ git config --global alias.logline "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
$ git logline
@handleman
handleman / Install-php-mysql-apache-on-osx-with-brew.md
Last active October 11, 2018 11:42 — forked from GabLeRoux/Install-php-mysql-apache-on-osx-with-brew.md
Detailed steps to install PHP, MySQL, Apache and some usefull extensions such as xDebug on a mac running Mac Os X. Also included: PostgreSQL.

Install PHP, MySQL, PostgreSQL, Apache and xDebug on a Mac

You should have some tools installed like Homebrew, a text editor such as Sublime Text and it's subl command line app inside a bin folder and some basic terminal knowledge.

This gist is a more detailed version of niepi's gist with things that worked for me. It may help someone :)

Install PHP

$ brew install php --with-apache --with-mysql --with-pgsql --with-intl
@handleman
handleman / Install Composer to use MAMP's PHP.md
Created October 11, 2018 07:04 — 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 ~/.bash_profile

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