Skip to content

Instantly share code, notes, and snippets.

@kosyfrances
kosyfrances / 0_reuse_code.js
Last active August 29, 2015 14:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kosyfrances
kosyfrances / multiple_env_heroku.txt
Created December 7, 2015 22:05
Managing multiple environments for an app in heroku
Follow the instructions here -
https://devcenter.heroku.com/articles/multiple-environments#starting-from-an-existing-app
@kosyfrances
kosyfrances / aws_ec2.md
Last active January 7, 2016 08:53
Setting up and launching an Amazon EC2 ubuntu instance.

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizeable computing capacity—literally, servers in Amazon's data centers—that you use to build and host your software systems.

If you are new to Amazon EC2. First set up using this link. http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/get-set-up-for-amazon-ec2.html

Then launch and connect to your new instance using this http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html

If you need to create a nonroot user, here’s how:

# these commands must be run as root
root@server:$ useradd -m -s /bin/bash elspeth # add user named elspeth
@kosyfrances
kosyfrances / coverage.md
Last active January 7, 2016 08:54
To combine multiple coverage reports in coverage.py
@kosyfrances
kosyfrances / python_test.md
Last active January 7, 2016 09:01
To run all tests in files in a folder in python
@kosyfrances
kosyfrances / deploy_python_bot.md
Last active January 7, 2016 09:03
Deploying a pure python slack-bot on heroku

This is not explanatory, and I have plans to explain better in my up-coming blog. It was difficult for me to find comprehensive information for pure python apps when I wanted to deploy my bot to heroku

Follow this process: https://devcenter.heroku.com/articles/getting-started-with-python Scale the worker process with heroku ps:scale worker=1 to keep the bot process running

@kosyfrances
kosyfrances / unknown_locale.md
Last active January 21, 2016 09:02
unknown locale: UTF-8 error

We had this error when I was trying to use django rest swagger in the api we built,

unknown locale: UTF-8
Request Method:	GET
Request URL: http://localhost:8000/docs
Django Version:	1.8.2
Exception Type:	ValueError
Exception Value:	
unknown locale: UTF-8```
@kosyfrances
kosyfrances / fabric_ssh.md
Last active February 2, 2016 11:02
To configure the system so that you can do fabric (i.e. SSH) without password.

For this, on local machine do:

ssh-keygen and agree with all defaults (if you have no reasons do otherwise) cat ~/.ssh/id_rsa.pub and copy that key

On remote machine:

mkdir ~/.ssh && chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys2 && chmod 600 ~/.ssh/authorized_keys2

@kosyfrances
kosyfrances / docker_not_running.md
Created February 3, 2016 11:27
Docker error while trying to connect

I had this error while running vagrant provision - ==>

The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.```

Even when trying docker commands I got something like -   
```ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?```
@kosyfrances
kosyfrances / querySelector.md
Created February 15, 2016 10:18
Get elements with one class but not another without iterating - Javascript