Skip to content

Instantly share code, notes, and snippets.

View gembin's full-sized avatar
🎯
Focusing

gembin

🎯
Focusing
  • Seattle, WA
  • 08:00 (UTC -07:00)
View GitHub Profile
@gembin
gembin / mac_os_open_files_limit.md
Created January 25, 2018 14:49
Mac OS Open Files Limit

Open Files Limit

Changing Limit For Current Session

Most operating systems can change the open-files limit for the current shell session using the ulimit -n command:

ulimit -n 200000

Mac OS X El Capitan

@gembin
gembin / python3_create_venv.md
Last active January 25, 2018 15:51
Python 3 Creation of virtual environments (3.5+)

Creating virtual environment

python3 -m venv /path/to/new/virtual/environment

NOTE:

  • Changed in version 3.5: The use of venv is now recommended for creating virtual environments.
  • Deprecated since version 3.6: pyvenv was the recommended tool for creating virtual environments for Python 3.3 and 3.4, and is deprecated in Python 3.6.
@gembin
gembin / mac_install_cmake.md
Created February 27, 2018 07:03
Install cmake on Mac OSX
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
brew install cmake
@gembin
gembin / ssh_port_forward.md
Last active March 15, 2018 07:18
SSH Port Forwarding on Mac OS X
ssh    -L local_port:service_host:service_port \
       -p ssh_server_port \
       -l ssh_server_username \
       -N \
       ssh_server_host
@gembin
gembin / set_jdk_mac.md
Last active April 8, 2018 03:08
Switching JDK on Mac OS X

/usr/libexec/java_home -V command to get the list of installed JDKs.

For example:

Matching Java Virtual Machines (2):
    9.0.4, x86_64:	"Java SE 9.0.4"	/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
    1.8.0_161, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
@gembin
gembin / rsa_private_public_key.md
Last active March 6, 2024 10:36
Use RSA private key to generate public key?

To encrypt something using RSA algorithm you need modulus and encryption (public) exponent pair (n, e). That's your public key. To decrypt something using RSA algorithm you need modulus and decryption (private) exponent pair (n, d). That's your private key.

To encrypt something using RSA public key you treat your plaintext as a number and raise it to the power of e modulus n:

ciphertext = ( plaintext^e ) mod n

To decrypt something using RSA private key you treat your ciphertext as a number and raise it to the power of d modulus n:

plaintext = ( ciphertext^d ) mod n
@gembin
gembin / ca.md
Created May 12, 2018 08:50 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@gembin
gembin / git-branch-simplify.md
Created June 6, 2018 06:49 — forked from datagrok/git-branch-simplify.md
How to simplify the graph produced by git log --graph

Ideas for improvements to git log --graph

I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.

Make the graph for --topo-order less wiggly

Imagine a long-running development branch periodically merges from master. The git log --graph --all --topo-order is not as simple as it could be, as of git version 1.7.10.4.

It doesn't seem like a big deal in this example, but when you're trying to follow the history trails in ASCII and you've got several different branches displayed at once, it gets difficult quickly.

@gembin
gembin / git-merge-commits.md
Last active October 2, 2020 15:09
Git merge commits into one

Interactively

git rebase --interactive HEAD~2
pick bf7416a commit-2
pick fbc0ef9 commit-3