- 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
| require 'benchmark/ips' | |
| require 'redis' | |
| class MethodProfiler | |
| def self.patch(klass, methods, name) | |
| patches = methods.map do |method_name| | |
| <<~RUBY | |
| unless defined?(#{method_name}__mp_unpatched) | |
| alias_method :#{method_name}__mp_unpatched, :#{method_name} | |
| def #{method_name}(*args, &blk) | |
| unless prof = Thread.current[:_method_profiler] |
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
| --- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md | |
| --- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192 | |
| -- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB. | |
| ------------ | |
| -- Basics -- | |
| ------------ | |
| -- Get indexes of tables |
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. |