Skip to content

Instantly share code, notes, and snippets.

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 17, 2024 23:43
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@smileart
smileart / README.md
Last active March 16, 2024 15:42 — forked from agnoster/README.md
My ZSH Theme — Agnoster Mod

My modified fork of agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

Compatibility

@JamieMason
JamieMason / is_installed.sh
Last active February 17, 2024 10:12
Check if a program exists from a bash script.Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
@bsodmike
bsodmike / restore_dump.sh
Created July 26, 2013 15:59
A shell script to restore a large MySQL dump using root login.
#!/bin/bash
# A shell script to restore a large SQL dump using root login.
# Usage: ./restore_dump.sh dump.sql app_devdb
#
# Author: Michael de Silva (michael@mwdesilva.com / http://github.com/bsodmike)
(( $# != 2 )) && { echo "Usage: $0 dump.sql database_name"; exit 1; }
[ ! -f $1 ] && { echo "$1 not found1"; exit 1; }
RESULT=`mysql -u root -p --skip-column-names -e "SHOW DATABASES LIKE '$2'"`
@mythmon
mythmon / sumo_db_import.sh
Created August 9, 2013 17:23
This is the script I use to set import a large database dump. It goes faster than simply piping into mysql.
#!/bin/bash
SCHEMA="support_mozilla_com.2013.07.17.schema.sql"
DATA="support_mozilla_com.2013.07.17.data.sql"
SIZE="$(du $DATA | awk '{ print $1 }')K"
DBNAME="kitsune"
{
echo "Dropping/creating database ${DBNAME}" >&2
echo "DROP DATABASE IF EXISTS ${DBNAME};"
@mitchwongho
mitchwongho / Docker
Last active November 29, 2023 06:36
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@alexpchin
alexpchin / restful_routes.md
Last active June 16, 2024 04:26
7 Restful Routes
URL HTTP Verb Action
/photos/ GET index
/photos/new GET new
/photos POST create
/photos/:id GET show
/photos/:id/edit GET edit
/photos/:id PATCH/PUT update
/photos/:id DELETE destroy
@paulirish
paulirish / what-forces-layout.md
Last active June 19, 2024 15:52
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@junkystu
junkystu / laravel-forge-deployment-script.sh
Last active May 23, 2021 05:18
Script for quicker deployment with Laravel and Forge
# The idea of this deployment script is to create a deploy copy of your website and handle
# Git and Composer updates in there. Aferwards, it just renames that deploy copy to become the
# live website. We then run the database migrations and take the application out of maintenance mode.
# Obviously, you will have to replace all instances of {{ websiteName }} with the name of your website and
# {{ branchName }} with the name of the branch you would like to pull changes from. This is usually the master branch.
# Start by checking for for old deployment folder and remove it if we have one.
if [ -d "/home/forge/{{ websiteName }}-deploy" ]; then
rm -Rf /home/forge/{{ websiteName }}-deploy
@danilostrazzullo
danilostrazzullo / import-dump.sh
Created May 4, 2016 14:02
Import a large sql dump file to a MySQL database from command line
#!/bin/sh
# Import a large sql dump file to a MySQL database from command line
# https://cmanios.wordpress.com/2013/03/19/import-a-large-sql-dump-file-to-a-mysql-database-from-command-line/
# store start date to a variable
imeron=`date`
echo "Import starting..."
dumpfile="/path/to/dumpfile.sql"