Skip to content

Instantly share code, notes, and snippets.

View AbdulR3hman's full-sized avatar
🐋
Focusing

AbdulRehman AbdulR3hman

🐋
Focusing
  • New York [Prev. London, UK]
View GitHub Profile
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;
@AbdulR3hman
AbdulR3hman / localPorts.sh
Created April 16, 2017 23:19 — forked from m5m1th/localPorts.sh
Redirect port 3080/3443 to 80/443 for local dev
#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
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
#!/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