- http://stackoverflow.com/questions/804115 (
rebasevsmerge). - https://www.atlassian.com/git/tutorials/merging-vs-rebasing (
rebasevsmerge) - https://www.atlassian.com/git/tutorials/undoing-changes/ (
resetvscheckoutvsrevert) - http://stackoverflow.com/questions/2221658 (HEAD^ vs HEAD~) (See
git rev-parse) - http://stackoverflow.com/questions/292357 (
pullvsfetch) - http://stackoverflow.com/questions/39651 (
stashvsbranch) - http://stackoverflow.com/questions/8358035 (
resetvscheckoutvsrevert)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Box do | |
| defmacro __using__(_env) do | |
| quote do | |
| import Box | |
| end | |
| end | |
| @doc """ | |
| Define module with struct and typespec, in single line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Source: https://www.cyberciti.biz/tips/linux-unix-bsd-nginx-webserver-security.html | |
| This page collects hints how to improve the security of nginx web servers running on Linux or UNIX-like operating systems. | |
| Default Config Files and Nginx Port | |
| /usr/local/nginx/conf/ or /etc/nginx/β The nginx server configuration directory and /usr/local/nginx/conf/nginx.conf is main configuration file. | |
| /usr/local/nginx/html/ or /var/www/htmlβ The default document location. | |
| /usr/local/nginx/logs/ or /var/log/nginx β The default log file location. | |
| Nginx HTTP default port : TCP 80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## | |
| # Parallel test Runner for Rails | |
| # | |
| # This is a spike implementation for multi-process parallel testing with Rails. | |
| # Only works with SQLite3 right now, and doesn't clean up. | |
| # | |
| # Here is an example of how to use it: | |
| # | |
| # ```ruby | |
| # require 'forking_executor' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule ScoutApm.Absinthe.Plug do | |
| alias ScoutApm.Internal.Layer | |
| def init(default), do: default | |
| def call(conn, _default) do | |
| ScoutApm.TrackedRequest.start_layer("Controller", action_name(conn)) | |
| conn | |
| |> Plug.Conn.register_before_send(&before_send/1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # james shubin, agplv3+ | |
| # pause until key press and then continue | |
| # https://ttboj.wordpress.com/2017/01/06/ten-minute-hacks-process-pause-resume | |
| if [ ! "$#" -eq 1 ]; then | |
| echo "Usage: `basename $0` <process>" | |
| echo "Pauses process until key press and then continues!" | |
| exit 1 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Stop all containers | |
| docker stop `docker ps -qa` | |
| # Remove all containers | |
| docker rm `docker ps -qa` | |
| # Remove all images | |
| docker rmi -f `docker images -qa ` | |
| # Remove all volumes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule KeyValueStore do | |
| use GenServer | |
| @me __MODULE__ | |
| @moduledoc """ | |
| Implement a simple key-value store as a server. This | |
| version creates a named server, so there is no need | |
| to pass the server pid to the API calls. |
Optimistic Locking assumes that a database transaction conflict is very rare to happen. It uses a version number of the record to track the changes. It raise an error when other user tries to update the record while it is lock.
usage
Just add a lock_version column to the table you want to place the lock and Rails will automatically check this column before updating the record.
Pessimistic locking assumes that database transaction conflict is very likely to happen. It locks the record until the transaction is done. If the record is currently lock and the other user make a transaction, that second transaction will wait until the lock in first transaction is release.
usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Priority Queues | |
| βββββββββββββββ | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| INSERT DEL-MIN MIN DEC-KEY DELETE MERGE | |
| binary log n log n 1 log n log n n | |
| binomial 1 log n 1 log n log n log n | |
| Fibonacci 1 log nβ 1 1β log nβ log n | |
| Pairing 1β log nβ 1β 1β log nβ 1β | |
| Brodal-Okasaki 1 log n 1 1 log n 1 |