Sublime Text SFTP Package Server Locations

Writing by on Thursday, 30 of June , 2016 at 6:59 am

Sublime Text SFTP is an amazing and very nifty package to update remote files. I’ve been using it for a while now and the location where the SFTP Server Location where the config settings to the hosts are stored.

Now it’s different for different versions, but if you’re on a Mac then you may want to Setup a Server and save the config under
~/Library/Application Support/Sublime Text 3/Packages/User/sftp_servers. Sublime Text will not be able to detect the servers if they’re not stored in that location. You may want to find the folder sftp_servers which can be in /Library or ~/Library.

Leave a comment

Category: Linux,Mac

Mission Control suddenly stops working

Writing by on Friday, 3 of June , 2016 at 6:44 am

Just run killall Dock. This article from App Exchange explains the details.

killall Dock

Don’t know the root cause for it, but workarounds work great!

Leave a comment

Category: Apple,Mac

Installing and Running MySQL on Mac

Writing by on Friday, 27 of May , 2016 at 7:35 am

Painful process, but you will need to see what works for you.

Say you’ve done the following:

  • Downloaded the DMG and installed MySQL on your Mac (and it provided you a password)
  • Started it from System Preferences -> MySQL
  • Now you tried different ways to connect to MySQL but are not able to login to localhost
  • So, then you tried brew and it didn’t work. Go ahead and remove mysql from brew
    • sudo brew remove mysql
    • brew cleanup

Now, here’s what worked for me, thanks to the following:

  • https://www.variphy.com/support/knowledge-base/mac-os-x-reset-mysql-root-password
  • http://stackoverflow.com/questions/30692812/mysql-user-db-does-not-have-password-columns-installing-mysql-on-osx

# Start MySQL in Safe Mode
$ sudo /usr/local/mysql/bin/mysqld_safe –skip-grant-tables

# Connect to MySQL as root (without password)
$ sudo /usr/local/mysql/bin/mysql -u root

# Update the password
mysql>use mysql;
mysql>show tables;
mysql> update user set authentication_string=password(‘new_password’) where user=’root’;

# Kill the mysql safe process and start it from System Preferences -> MySQL
alias mysql=’/usr/local/mysql/bin/mysql -uroot -ppassword’

That worked for me and I was able to kill the mysql safe-mode process and connect to MySQL through CLI as well as a GUI like Sequel Pro.

Optionally, to add python drivers that will fail further if the following is not done.

# add this to your $PATH
export PATH=$PATH:/usr/local/mysql/bin

# pip install in the right venv
pip install MySQL-python

Leave a comment

Category: Mac,SQL DB

Connection refused while trying to ssh localhost on Mac

Writing by on Sunday, 15 of May , 2016 at 4:04 am

Although SSH is available on the Mac, you need to enable Remote Login. Otherwise you will see

$ ssh localhost
ssh: connect to host localhost port 22: Connection refused

Good article from StackOverflow describes this

System Preferences -> (under) Internet & Networking -> Sharing -> check Remote Login and select the users

Leave a comment

Category: Mac

Create a new user on EC2 and give sudo privileges

Writing by on Monday, 2 of May , 2016 at 10:00 pm

Assumptions:
newhost.compute.internal is the new host you launched
ec2-user is the user created by EC2
newuser is the user you want created and need password-less ssh & sudo privileges
– id_rsa.pub is newuser’s public key

# Copy newuser’s id_rsa.pub to the new instance
scp -i ~/.ssh/my.pem ~/.ssh/id_rsa.pub ec2-user@newhost.compute.internal:~

# Login to the newhost (and sudo as root)
ssh -i ~/.ssh/my.pem ec2-user@newhost.compute.internal
sudo su –

# add newuser and copy the keys
useradd -c “firstname lastname” newuser
cd /home/newuser
mkdir .ssh
cat /home/ec2-user/newuser.pub >> .ssh/authorized_keys

# provide right ownership and permissions
chmod 700 .ssh
chmod 600 .ssh/authorized_keys
chown -R newuser:newuser /home/newuser

# give sudo access
vim /etc/sudoers
newuser ALL=(ALL:ALL) NOPASSWD:ALL

Leave a comment

Category: AWS

Determine size of an S3 bucket or folder

Writing by on Wednesday, 16 of March , 2016 at 6:01 pm

Ensure that you have awscli installed as well as your keys setup in ~/.aws/credentials

To determine the size of an S3 Bucket or a folder, you can summarize the output as follows.

aws s3 ls –summarize –human-readable –recursive s3://mybucket/directory/

2015-03-05 19:57:33 71 Bytes directory/sub1/sub2/file.gz

Total Objects: 71
Total Size: 81.9 MiB

To determine the size of an S3 Bucket, you can also use s3api list-objects as shown below.

aws s3api list-objects –bucket mybucket –output json –query “[sum(Contents[].Size), length(Contents[])]”
[
351885203186,
4668
]

For more info refer to ServerFault

Leave a comment

Category: AWS

Shivdev Kalambi's Blog

Shivdev Kalambi is a Software Development Manager, previously a Principal Software Engineer at ArcSight/HP. With over 16 years' experience in software development, he's worked on several technologies and played different roles and contributed to all phases of projects. Non-tech activies include Ping-pong, Rock Climbing and Yoga at PG, Golf, Skiing, Swimming & a beer enthusiast.