Open a terminal and run the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
To see if PostgreSQL is already installed via Homebrew, you can use:
require 'objspace' | |
# Helper function to format memory size into human-readable units | |
def human_readable_size(size_in_bytes) | |
return "#{size_in_bytes} bytes" if size_in_bytes < 1024 | |
return "#{(size_in_bytes / 1024.0).round(2)} KB" if size_in_bytes < 1024 * 1024 | |
return "#{(size_in_bytes / 1024.0 / 1024.0).round(2)} MB" if size_in_bytes < 1024 * 1024 * 1024 | |
return "#{(size_in_bytes / 1024.0 / 1024.0 / 1024.0).round(2)} GB" | |
end |
Open a terminal and run the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
To see if PostgreSQL is already installed via Homebrew, you can use:
#!/bin/sh | |
### you can add it to cron and execute on hourly/daily/weekly/monthly basis | |
### this script logs into cleanup_logs.log file | |
find /home /var/log -type f -name "*.log" -exec bash -c 'size=$(du -m "{}" | cut -f1); [ "$size" -gt 1 ] && truncate -s 1M "{}" && echo "{}"' \; >> cleanup_logs.log | |
echo "last started at $(date)" >> cleanup_logs.log |
#!/bin/bash | |
set -ueo pipefail | |
usage_example="USAGE:\n\tExample: ./remove_node_modules ~/your-dev-folder" | |
if [ $# -lt 1 ] | |
then | |
echo -e $usage_example | |
exit 1 | |
fi |
version: '2' | |
services: | |
zookeeper: | |
image: wurstmeister/zookeeper | |
ports: | |
- "2181:2181" | |
kafka-1: | |
image: wurstmeister/kafka | |
ports: | |
- "9095:9092" |
openssl genrsa -out jwtRS256private.pem 2048 | |
openssl rsa -in jwtRS256private.pem -outform PEM -pubout -out jwtRS256public.pem |
To get a private GitHub repo to work on Heroku, you can leverage the netrc buildpack in conjunction with the Heroku Ruby buildpack.
When setting up the Gemfile
, make sure to use the https GitHub URL. This mechanism does not work with git+ssh.
gem "some_private_gem", git: "https://github.com/org/some_private_gem.git"
#.ebextensions/01-edit-nginx.config | |
container_commands: | |
01backup_config: | |
command: "cp -n /opt/elasticbeanstalk/support/conf/nginx_config.erb /opt/elasticbeanstalk/support/conf/nginx_config.erb.original" | |
02edit_config: | |
command: "sh -c \"sed '/string_to_insert_text_after/ i\ | |
\ text_to_be_inserted;' /opt/elasticbeanstalk/support/conf/nginx_config.erb.original > /opt/elasticbeanstalk/support/conf/nginx_config.erb\"" |
ruby -rsocket -e "trap('SIGINT') { exit }; Socket.tcp_server_loop(8080) { |s,_| puts s.readpartial(1024); puts; s.puts 'HTTP/1.1 200'; s.close } |
RSpec::Mocks.space.proxy_for(SomeClass).reset |