Skip to content

Instantly share code, notes, and snippets.

View romantomjak's full-sized avatar

Roman Tomjak romantomjak

View GitHub Profile
@romantomjak
romantomjak / CustomRootCAAPIClient.h
Last active August 25, 2017 10:04
SSL with custom root CA certificate using AFNetworking 2.x on iOS 7 and iOS 8
//
// CustomRootCAAPIClient.h
//
// Created by Roman Tomjak on 19/12/14.
// Copyright (c) 2014 Roman Tomjak. All rights reserved.
//
#import <AFHTTPSessionManager.h>
@interface CustomRootCAAPIClient : AFHTTPSessionManager
@romantomjak
romantomjak / SublimeText3PythonVirtualEnvWrapperBuildSystem.md
Last active September 11, 2018 09:17
Sublime Text 3 Python VirtualEnvWrapper Build System

Open your package folder (Preferences > Browse packages) and create a file named Python (VirtualEnvWrapper).sublime-build. That will be our build system.

WARNING: Make sure your sublime project name is the same as virtualenvwrapper project name!

Now copy-paste the following JSON:

{
    "shell_cmd": "~/.virtualenvs/$project_base_name/bin/python3 -u \"$file\"",
    "path": "$project_path",

"file_regex": "^[ ]File "(...?)", line ([0-9]*)",

@romantomjak
romantomjak / ProfilingPython3CodeWithcProfieAndCProfileV.md
Last active July 16, 2022 16:49
Profiling Python 3 Code with cProfile and CProfileV

First, profile your code with cProfile:

$ python3 -m cProfile -o profile_output search.py

But output of that is not very helpful. To make sense of the cProfiler's output install CProfileV:

# install cprofilev
$ pip3 install cprofilev
@romantomjak
romantomjak / DownloadSlideSharePresentation.md
Last active May 8, 2017 15:03
Download SlideShare presentation from the command line (JPG to PDF)
@romantomjak
romantomjak / OSX_PhpStorm_Java8.md
Last active August 29, 2015 14:23
How to properly run PhpStorm with JAVA8 on OSX

First, create PhpStorm's configuration folder

mkdir -p ~/Library/Preferences/WebIde80/

Then copy current configuration

cp /Applications/PhpStorm.app/Contents/bin/idea.properties ~/Library/Preferences/WebIde80/
@romantomjak
romantomjak / letsencrypt-ssl
Last active March 26, 2016 14:11 — forked from thisismitch/le-renew-webroot
Let's Encrypt Auto-Renewal using the Webroot Plugin (Nginx)
location ~ /.well-known {
allow all;
root /var/www/letsencrypt;
}
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/certs/dhparam.pem;

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@romantomjak
romantomjak / sublime3-alias.md
Created January 15, 2018 20:00
Bash alias for Sublime Text 3

Open or create ~/.bash_profile and add the following lines:

# Sublime
alias sublime='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'

This will allow you to type sublime in the Terminal to open Sublime Text 3.

To open files with Sublime type the following command:

@romantomjak
romantomjak / ssh-autocompletion.md
Created January 15, 2018 20:34
Bash autocomplete for hosts defined in SSH config

Open or create ~/.bash_profile and add the following lines:

# ssh autocomplete
function _ssh_autocomplete() {
  COMPREPLY=()
  CURRENT_WORD="${COMP_WORDS[COMP_CWORD]}"
  if [[ ${CURRENT_WORD} == -* || ${COMP_CWORD} -eq 1 ]] ; then
    WORD_LIST=$(sed -nE "s/Host\ ([a-zA-Z0-9].+)/\1/p" ~/.ssh/config | tr '\n' ' ' )
 COMPREPLY=( $(compgen -W "$WORD_LIST" -- ${CURRENT_WORD}) )
/*
* Apple - apple.com
* SF Pro Display used on apple.com as of iPhone 7 (RED) launch (March 21st 2017)
usage:
- font-family: "SF Pro Display","SF Pro Icons","Helvetica Neue","Helvetica","Arial",sans-serif;
- known issues:
- Access to Font at 'http://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_bold.woff' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 404.
index.html:1 Access to Font at 'http://www.apple.com/wss/fonts/SF-Pro-Display/v1/sf-pro-display_bold.ttf' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 404.