This file contains 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
How do I point my custom domain to my IP:Port (41.111.20.36:8080)? | |
add new record: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean | |
and install nginx | |
remove default from /etc/nginx/sites-available&Enabled | |
copy the following and in /etc/nginx/sites-available | |
server { | |
listen 80; |
This file contains 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
#Requests from outside | |
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3080 | |
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 3443 | |
#Requests from localhost | |
iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 3080 | |
iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 443 -j REDIRECT --to-ports 3443 |
This file contains 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
Assume we have the following SQL in our ruby; | |
"Select * from employee em where em.id = 1" | |
now, I want to keep my sql in a seperate file and do the following | |
sql.exec (employee, 3) and this would call the above sql with a toknized id and filters |
This file contains 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
#!/usr/bin/env ruby | |
# Public: Calculates the nth Fibonacci number using either a memoized or | |
# non-memoized functionality | |
# | |
# Examples | |
# | |
# fib = Fibonacci.new | |
# fib.get_fib 10 | |
# # => 55 |