Skip to content

Instantly share code, notes, and snippets.

View TheAshwanik's full-sized avatar
💭
Hi.. Don't hesitate to ping me.. I would love an interesting chat about tech.

Ashwani Kumar TheAshwanik

💭
Hi.. Don't hesitate to ping me.. I would love an interesting chat about tech.
View GitHub Profile

Rails Generating & Scaffolding

Rails' use of strict naming conventions means a lot of core code SHOULD be in the same format whoever writes it? It could be written by a friend, colleague or a computer... it shouldn't matter because the same Rails rules apply to everyone.

This means that Rails can actually do some tasks for you! It can actually build things and write code on your behalf...

Coming from another language like PHP, this can seem like magic.

@TheAshwanik
TheAshwanik / domain-to-aws-ec2-instance.md
Created December 25, 2019 12:39 — forked from keithweaver/domain-to-aws-ec2-instance.md
Point Domain to Amazon Web Services (AWS) EC2 Instance

Point Domain to Amazon Web Services (AWS) EC2 Instance

  1. Open the Amazon Route 53 console at https://console.aws.amazon.com/route53/.
  2. If you are new to Amazon Route 53, you see a welcome page; choose Get Started Now for DNS Management. Otherwise, choose Hosted Zones in the navigation pane.
  3. Choose Create Hosted Zone.
  4. For Domain Name, type your domain name.
  5. Choose Create.
  6. Click the Hosted Zone, edit record set.
  7. In the value, add ec2-54-152-134-146.compute-1.amazonaws.com.
  8. Change your DNS file to point to the IPv4 address (This would be in something like GoDaddy).
@TheAshwanik
TheAshwanik / Git Commands
Last active July 9, 2020 23:40
Git Commands
99% of the Git commands you'll need at work, demonstrated in a single script (bitbucket.org)
https://bitbucket.org/BitPusher16/dotfiles/raw/49a01d929dcaebcca68bbb1859b4ac1aea93b073/refs/git/git_examples.sh
https://news.ycombinator.com/item?id=21189256
#!/bin/bash
##########
# contents
@TheAshwanik
TheAshwanik / encrypt_openssl.md
Created March 31, 2019 13:31 — forked from dreikanter/encrypt_openssl.md
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

@TheAshwanik
TheAshwanik / fail2ban_notifier.rb
Created December 27, 2018 00:32 — forked from etdsoft/fail2ban_notifier.rb
Simple Fail2banNotifier for exception_notification (will submit a pull request and update gist when accepted). See: http://securityroots.com/blog/2014/01/protecting-app-rails-fail2ban/
class Fail2banNotifier
def initialize(options)
@default_options = options
@default_options[:logfile] ||= Rails.root.join('log', 'fail2ban.log')
# Roll over every 30M, keep 10 files
@logger ||= Logger.new(@default_options[:logfile], 10, 30*1024*1024)
end
def call(exception, options={})
@TheAshwanik
TheAshwanik / letsencrypt_2018.md
Created June 27, 2018 06:40 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@TheAshwanik
TheAshwanik / deploy-static-site-heroku.md
Created December 16, 2017 23:57 — forked from wh1tney/deploy-static-site-heroku.md
How to deploy a static website to Heroku

Gist

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.

Basic Assumptions

@TheAshwanik
TheAshwanik / keybase.md
Last active June 17, 2017 16:11
My Keybase proof

Keybase proof

I hereby claim:

  • I am Theashwanik on github.
  • I am theashwanik (https://keybase.io/theashwanik) on keybase.
  • I have a public key whose fingerprint is 635A A154 F18F 18A5 8079 CB70 90B0 8072 243E 96CB

To claim this, I am signing this object:

@TheAshwanik
TheAshwanik / wifi
Created October 2, 2015 05:42
Spoof on a paid/public Wifi
* Launch Terminal.
* Check your own MAC address:
ifconfig en1 | grep ether
* See who else is on the network:
arp -a
@TheAshwanik
TheAshwanik / README.md
Last active September 8, 2015 10:31 — forked from mbostock/.block
Collapsible Tree