Changes with .dev domains in
mind.
Create /etc/pf.anchors/dev, containing:
rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080
rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 8443
Changes with .dev domains in
mind.
Create /etc/pf.anchors/dev, containing:
rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080
rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 8443
First, check your current config (example output in homebrew.mxcl.postgresql.plist.xml lower down in this gist):
cat ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plistMost importantly, note the -D /usr/local/var/postgres argument.
Second, shut down your current PostgreSQL.
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist| $ brew uninstall postgresql | |
| $ gem uninstall pg # ALL OF THEM | |
| $ rm -fr /usr/local/var/postgres | |
| $ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist | |
| $ pg_ctl -D /usr/local/var/postgres stop -s -m fast # WE SHOULD HAVE ALL postgres SERVERS & PROCESSES STOPPED BY NOW | |
| $ brew install postgres | |
| $ env ARCHFLAGS="-arch x86_64" gem install pg | |
| $ echo "DONE." >> /dev/null | |
I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api
Rails.application.routes.draw do
constraints subdomain: "api" do
scope module: "api" do| func main() { | |
| str := "abc foo:bar def baz:qux ghi" | |
| re := regexp.MustCompile("([a-z]+):([a-z]+)") | |
| result := ReplaceAllStringSubmatchFunc(re, str, func(groups []string) string { | |
| return groups[1] + "." + groups[2] | |
| }) | |
| fmt.Printf("'%s'\n", result) | |
| } |
| # Install ARCH Linux with encrypted file-system and UEFI | |
| # The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description. | |
| # Download the archiso image from https://www.archlinux.org/ | |
| # Copy to a usb-drive | |
| dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux | |
| # Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration. | |
| # Set swiss-french keymap |
| Julia and Samantha are playing with strings. Julia has a string S, and Samantha has a string T which is a subsequence of string S. They are trying to find out what words are missing in T. | |
| Help Julia and Samantha to solve the problem. List all the missing words in T, such that inserting them at the appropriate positions in T, in the same order, results in the string S. | |
| Constraints | |
| 1 <= |T| <= |S| <= 106, where |X| denotes the length of string X. | |
| The length of each word will be less than 15. | |
| Function Parameter | |
| You are given a function missingWords that takes the strings S and T as its arguments. | |
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
| require 'csv' | |
| file = "#{Rails.root}/public/data.csv" | |
| table = User.all;0 # ";0" stops output. Change "User" to any model. | |
| CSV.open( file, 'w' ) do |writer| | |
| writer << table.first.attributes.map { |a,v| a } | |
| table.each do |s| | |
| writer << s.attributes.map { |a,v| v } |