Skip to content

Instantly share code, notes, and snippets.

Anand luckydev

Block or report user

Report or block luckydev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@luckydev
luckydev / install-codedeploy.sh
Last active Jan 24, 2019
Install codedeploy agent in an EC2 instance
View install-codedeploy.sh
#!/bin/bash
sudo apt-get -y install ruby
sudo apt-get -y install wget
# this location varies for every region. replace aws-codedeploy-us-west-1 with name given here https://docs.aws.amazon.com/codedeploy/latest/userguide/resource-kit.html#resource-kit-bucket-names
wget -c https://aws-codedeploy-us-west-1.s3.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
@luckydev
luckydev / gist:ed966a7c12fd4b1311c063b77dc81389
Created Feb 20, 2018
Reset Google authenticator token (2FA) for a specific openvpn user
View gist:ed966a7c12fd4b1311c063b77dc81389
SSH Login as openvpnas user
$ ssh openvpnas@<open-vpn-server-ip>
$ cd /usr/local/openvpn_as/scripts/ # Go to OpenVPN AS Scripts directory
$ sudo ./sacli --user USERNAME GoogleAuthRegen # Replace USERNAME with username to get a new Google Authenticator Secret
Source: https://forums.openvpn.net/viewtopic.php?t=15366
@luckydev
luckydev / gist:b2a6ebe793aeacf50ff15331fb3b519d
Last active Jan 15, 2020
Increate max no of open files limit in Ubuntu 16.04/18.04 for Nginx
View gist:b2a6ebe793aeacf50ff15331fb3b519d
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
@luckydev
luckydev / gist:fa20f717aa677751d0f6
Created Jun 24, 2015
add these lines to nginx config
View gist:fa20f717aa677751d0f6
upstream railsapp {
server 0.0.0.0:5000 weight=10 max_fails=5 fail_timeout=30s;
}
server {
listen 80;
server_name admin.com;
location / {
proxy_pass http://railsapp/;
View about.md
@luckydev
luckydev / def_method
Last active Aug 29, 2015
Define method
View def_method
class Order
attr_accessor :amount
def amount=(given_amount)
#write your logic here
end
end
order = Order.new
@luckydev
luckydev / comment.java
Created May 11, 2014
My first pieces of web db code. Without ORM. or ActiveRecord.
View comment.java
public void addAComment(Comment c) throws Exception{
openConnection();
Statement st = connection.createStatement();
String query = "insert into comments (comment,personid,personname,issueid,commenton,companyid) " +
"values('"+c.getComment()+"',"+c.getPersonid()+",'"+c.getPersonname()+"',"+c.getIssueid()+",'"+c.getCommenton()+"',"+c.getCompanyid()+")";
st.execute(query);
System.out.println("====Comment added");
closeConnection();
}
View Apple Evangelists.txt
UI- and App Frameworks Evangelist - Jake Behrens, behrens@apple.com, twitter: @Behrens
- What's new in Cocoa
- Accessibility in iOS
- Building User Interfaces for iOS 7
- Getting Started with UIKit Dynamics
- What's new in Cocoa Touch
- What's New With Multitasking
- Best Practices for Cocoa Animation
- Improving Power Efficiency with App Nap
- Introducing Text Kit
@luckydev
luckydev / basic_style_guidelines
Last active Dec 31, 2015
Basic Style guidelines
View basic_style_guidelines
How to declare a method:
- (returntype)nameofTheMethodParam:(paramtype)paramname andAnotherParam:(paramtype)paramname;
+ (returntype)nameofTheMethodParam:(paramtype)paramname andAnotherParam:(paramtype)paramname;
Not like these:
-(returntype)nameofTheMethodParam:(paramtype)paramname andAnotherParam:(paramtype)paramname;
-(returntype) nameofTheMethodParam:(paramtype)paramname andAnotherParam:(paramtype)paramname;
You can’t perform that action at this time.