info

Shortcuts and cheat sheets for developers.

View on GitHub

       Live Demo Contributions welcome GitHub Issues License Awesome GitHub tweet

Windows DevelopmentmacOS DevelopmentAndroid DevelopmentAndroid StudioWebserver DevelopmentLinux StuffSublime TextGitHub Emotes

Info

Introduction

The living, breathing cheat-sheet!

Windows Development

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
foo@bar:~$ where gpg
C:\Program Files (x86)\GnuPG\bin\gpg.exe

foo@bar:~$ git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"

macOS Development

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
foo@bar:~$ sudo su
Password:🗝
pbcopy < ~/.ssh/id_rsa.pub
tmutil listlocalsnapshots /

The terminal will display Snapshots like: com.apple.TimeMachine.2018-03-01-00201

tmutil deletelocalsnapshots 2018-03-01-002010

Android Development

adb reboot bootloader
adb reboot fastboot
adb fastboot -w
fastboot oem unlock
fastboot flash bootloder 
fastboot erase cache
fastboot reboot

Android Studio

Tools → Android → AVD Manager →✏️→ Show Advanced Settings (scroll to bottom) → Enable Keyboard Input

Webserver Development

sudo apt update && sudo apt install php apache2 libapache2-mod-php php-curl libapache2-mod-auth-mysql mysql-server php-mysql phpmyadmin
mysql_secure_installation
mysql -u root -p
a2enmod rewrite
a2enmod headers
sudo php5enmod mcrypt
sudo service apache2 restart
sudo wget -O /usr/local/bin/rmate https://raw.github.com/aurora/rmate/master/rmate && sudo chmod a+x /usr/local/bin/rmate
rmate /etc/mysql/my.cnf
rmate /etc/php/7.0/apache2/php.ini
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

rmate /etc/apache2/apache2.conf
rmate /var/log/apache2/error.log
! /usr/bin/env bash
sudo apt-get build-dep curl
mkdir ~/curl
cd ~/curl
wget http://curl.haxx.se/download/curl-7.50.2.tar.bz2
tar -xvjf curl-7.50.2.tar.bz2
cd curl-7.50.2

In Review: Symbolic Link ln -s [current-target] [new-location]

sudo apt-get install make
wget https://www.openssl.org/source/openssl-1.1.0h.tar.gz
tar -xzvf openssl-1.1.0h.tar.gz
cd openssl-1.0.2g
sudo ./config -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)'
sudo make
sudo make install
sudo reboot
openssl version -v
<FilesMatch "\.(ttf|otf|eot|woff)$">
  <IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
  </IfModule>
</FilesMatch>
rm -rf /etc/letsencrypt/archive/domain.com/
rm -rf /etc/letsencrypt/live/domain.com/
rm -rf /etc/letsencrypt/renewal/domain.com.conf
rmate /etc/apache2/sites-available/000-default-le-ssl.conf
sudo crontab -e

Your text editor will open the default crontab which is a text file with some help text in it. Paste in the following line at the end of the file, then save and close it:

. . .
15 3 * * * /usr/bin/certbot renew --quiet

The 15 3 * * * part of this line means “run the following command at 3:15 am, every day”. You may choose any time.

The renew command for Certbot will check all certificates installed on the system and update any that are set to expire in less than thirty days. --quiet tells Certbot not to output information nor wait for user input.

cron will now run this command daily. Because we installed our certificates using the --apache plugin, Apache will also be reloaded to ensure the new certificates are used.

Linux Stuff

pwd
sudo useradd -G tomcat7 -m username
sudo userdel -r username
sudo usermod -g primarygroup username
sudo usermod -G admin,adm,merchant,issuer,username username
sudo groupadd groupname
gpasswd -d userName groupExiting
sudo chgrp -R groupname directoryname
sudo chsh -s /bin/bash username
chmod a+x ~/.bash_aliases
source ~/.bash_aliases
sudo find .-user jacob -exec chown jason:groupname {} \;

Sublime Text

subl ~/.ssh/config
Host domain.com
RemoteForward 52698 127.0.0.1:52698

Must be run as root

for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l 2>/dev/null | grep -v '^#'; done

GitHub Custom Emotes

Use these emotes anywhere on GitHub (only)

emote shortcode
:bowtie: :bowtie:
:neckbeard: :neckbeard:
:octocat: :octocat:
:shipit: :shipit:
:trollface: :trollface:
:suspect: :suspect:
:hurtrealbad: :hurtrealbad:
:feelsgood: :feelsgood:
:goberserk: :goberserk:
:finnadie: :finnadie:
:rage1: :rage1:
:rage1: :rage1:
:rage3: :rage3:
:rage4: :rage4:
:godmode: :godmode:

Contributors

GitHub Contributors Image

Your Repository's Stats