Skip to content

Instantly share code, notes, and snippets.

You should be able to download the latest python version and follow the README file. The steps should be simple enough.
./configure
make
make install
Note that you don't have to remove python-2.7.3 from your system to install an other version.
You can switch between different versions using
sudo update-alternatives --config python
@dawn360
dawn360 / Installing Kafka and Storm
Created September 9, 2016 18:35
Installing Kafka and Storm
Create a directory for storm and enter it
mkdir storm
cd storm
Create a data directory
mkdir -p datadir/zookeeper
Download ZooKeeper and unzip it
https://zookeeper.apache.org/releases.html(or the appropriate version)
tar -xvf zookeeper***
#Publish
import json
import boto3
message = {"foo": "bar"}
client = boto3.client('sns')
response = client.publish(
TargetArn=arn,
Message=json.dumps({'default': json.dumps(message)}),
PIP Upgrade all
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
@dawn360
dawn360 / xmlrpctimeout.py
Last active February 23, 2017 17:16
xmlrpc set timeout with custom transport
import http.client
import xmlrpc.client
class TimedTransport(xmlrpc.client.Transport):
timeout = 30
def set_timeout(self, timeout):
self.timeout = timeout
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_celeryd.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
# Get django environment variables
celeryenv=`cat /opt/python/current/env | tr '\n' ',' | sed 's/export //g' | sed 's/%/%%/g' | sed 's/$PATH/%(ENV_PATH)s/g' | sed 's/$PYTHONPATH//g' | sed 's/$LD_LIBRARY_PATH//g'`
celeryenv=${celeryenv%?}
@dawn360
dawn360 / trax_locks.sql
Last active November 6, 2018 14:09
MySQL Transaction Locks
select * from INFORMATION_SCHEMA.INNODB_TRX;
select * from INFORMATION_SCHEMA.INNODB_LOCKS;
SELECT CONCAT('KILL ', trx.trx_mysql_thread_id) kill_statement, trx.trx_mysql_thread_id thd_id, ps.user, ps.host, trx.trx_query FROM INFORMATION_SCHEMA.INNODB_TRX trx JOIN INFORMATION_SCHEMA.PROCESSLIST ps ON trx.trx_mysql_thread_id = ps.id WHERE user != 'system_user';
KILL 17333;
-- http://www.markleith.co.uk/2011/05/31/finding-and-killing-long-running-innodb-transactions-with-events/
@dawn360
dawn360 / laravelsnippets.sh
Last active December 17, 2018 20:46
Laravel Commands
php artisan make:controller -r -m=Post
AWS Composer update issue
https://getcomposer.org/doc/articles/troubleshooting.md#operation-timed-out-ipv6-issues-
https://github.com/composer/composer/issues/4247
run on deploy
php artisan config:cache
https://github.com/alexeymezenin/laravel-best-practices
@dawn360
dawn360 / ebs_monut.sh
Created November 28, 2018 19:31
Mount EBS to EC2
#list the disk you attached to your instance.
lsblk
#Check if the volume has any data using the following command.
sudo file -s /dev/xvdf
#Format the volume to ext4 filesystem using the following command.
sudo mkfs -t ext4 /dev/xvdf
#Create a directory of your choice to mount our new ext4 volume. I am using the name “newvolume”
sudo mkdir /newvolume
#Mount the volume to “newvolume” directory using the following command.
sudo mount /dev/xvdf /newvolume/
@dawn360
dawn360 / kube
Created December 5, 2018 19:03
Kubenetes on AWS
https://ramhiser.com/post/2018-05-20-setting-up-a-kubernetes-cluster-on-aws-in-5-minutes/
https://aws.amazon.com/blogs/aws/amazon-elastic-container-service-for-kubernetes/
https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#eks-guestbook
https://kubernetes.io/docs/setup/turnkey/aws/
https://medium.com/containermind/how-to-create-a-kubernetes-cluster-on-aws-in-few-minutes-89dda10354f4
https://www.weave.works/technologies/kubernetes-on-aws/
https://kubernetes.io/docs/tutorials/online-training/overview/
https://www.udacity.com/course/scalable-microservices-with-kubernetes--ud615