Skip to content

Instantly share code, notes, and snippets.

View martincr's full-sized avatar

martincr martincr

View GitHub Profile
1. Find > Replace
2. Click 'Regular Expression' box
3. Enter ^\s+ as your search string
4. Click 'Find' to confirm it works as anticipated
5. Use 'Replace All' to remove all leading spaces from each newline
NB. For trailing spaces replace with \s+$
@martincr
martincr / st3-macos-sierra.md
Last active September 13, 2017 15:06
Launch Sublime Text 3 from the command line in macOS Sierra. Add to Git configuration to use Sublime Text 3 as the message editor.

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

git config --global core.editor "subl -n -w"

ln -s "/Applications/Sublime Text (3126).app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

# sets the proxy cache path location, max size 2g
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=2g;
# transfers the `Host` header to the backend
proxy_set_header Host $host;
# uses the defined STATIC cache zone
proxy_cache STATIC;
# cache 200 10 minutes, 404 1 minute, others status codes not cached
https://images.unsplash.com/photo-1448318440207-ef1893eb8ac0
https://images.unsplash.com/photo-1447678523326-1360892abab8
https://images.unsplash.com/photo-1445754574409-bcd715e18017
https://images.unsplash.com/photo-1444682717031-a2498d603d5b
https://images.unsplash.com/photo-1442405740009-7b57cca9d316
https://images.unsplash.com/photo-1439337153520-7082a56a81f4
https://images.unsplash.com/photo-1433832597046-4f10e10ac764
https://images.unsplash.com/photo-1430651717504-ebb9e3e6795e
https://images.unsplash.com/photo-1428190318100-06790c8b2e5a
https://images.unsplash.com/photo-1422504090664-c57eba84293f
@martincr
martincr / gist:96fcb70d054a2c2e874594862b89a2b8
Last active March 20, 2021 11:24
Installing NPM to avoid using sudo on Mac OS X El Capitan. Node.js installed via https://nodejs.org/en/
$ node -v
v6.9.5
$ which gcc
/usr/bin/gcc
$ npm -v
3.10.10
$ mkdir "${HOME}/.npm-packages"
@martincr
martincr / sublime-text-3-user-settings.md
Created January 25, 2017 14:55
Some basic personal user settings for ST3.

{ "font_size": 12, "rulers": [80], "translate_tabs_to_spaces": true, "word_wrap": "true", "ignored_packages": [ "Vintage" ] }

sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/PATRIOT2 --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app
sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/ELCAPITAN --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app
1. Once your USB drive has been created, it's time to install El Capitan.
2. Restart your Mac and hold down the Option key immediately. When your machine boots up, choose the USB drive that says "Install OS X El Capitan"
3. Select "Disk Utility" and then select your main hard drive. Press "Erase" on the volume. Remember, this will erase EVERYTHING on your machine.
4. Go back to the main menu and choose "Install OS X." Select your internal hard drive when prompted and continue with the installation.

Database setup ##############

Using PostgreSQL, you need the psycopg2 package pip install psycopg2

psql
CREATE DATABASE mydjangosite;
\l
@martincr
martincr / Python-3-Django-El-Capitan.md
Last active May 4, 2022 05:04
Install Python 3 and Django on Mac OS X El Capitan (10.11.2) - and use virtualenv and virtualenvwrapper

Preamble

Background Reading

{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"copy_with_empty_selection": true,
"ensure_newline_at_eof_on_save": true,
"ignored_packages":
[
"Vintage"
],
"index_files": true,