Skip to content

Instantly share code, notes, and snippets.

View jay-johnson's full-sized avatar

Jay jay-johnson

View GitHub Profile
@jay-johnson
jay-johnson / Django_ReactJS_Webpack_project_setup.md
Created July 12, 2017 22:21 — forked from Belgabor/Django_ReactJS_Webpack_project_setup.md
Set up a Django + ReactJS project with Webpack manager

Guide on how to create and set up your Django project with webpack, npm and ReactJS :)

Hopefully this will answer "How do I setup or start a Django project?" I was trying to set up my own website, and there was a lot to read, learn and digest! Therefore, I put this together which is a collection of all the guides/blog posts/articles that I found the most useful. At the end of this, you will have your barebones Django app configured and ready to start building :)

NOTE: This guide was built using Django 1.9.5, NodeJS 4+ with NPM 3+

1. Setting up your dev environment

@jay-johnson
jay-johnson / Debugging Django Cache Ops cached records in Redis using the redis-cli.md
Last active July 8, 2017 19:20
Debugging Django Cache Ops cached records in Redis using the redis-cli
@jay-johnson
jay-johnson / Laravel - Logstash with Monolog.md
Last active June 28, 2017 21:53
Laravel - Logstash with Monolog

Add this to: bootstrap/app.php

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

$app->configureMonologUsing(function ($monolog) {
    $parameters = array(
        'host'     => '10.0.0.130',
        'port'     => 6379,
@jay-johnson
jay-johnson / S3 Bucket Policy for Public GET and specifying a user to have PUT + GET rights.md
Created June 28, 2017 07:33
S3 Bucket Policy for Public GET and specifying a user to have PUT + GET rights
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "statement1",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::USER_ARN_ID:user/USER_IAM_ID"
 },
@jay-johnson
jay-johnson / Python 2 vs Python 3 - Understanding Unicode Strings.md
Last active July 26, 2018 03:20
Python 2 vs Python 3 - Understanding Unicode Strings

Porting to Python 3 - git diff

Here's an example of porting changes when trying to deal with binary strings which are nothing more than serialized dictionaries (response.rendered_content). In python 2 json.loads(response.rendered_content) works just fine, but in python 3 I had to add .decode("utf-8"):

         # save to log
         try:
-            self.request.log.response = json.loads(response.rendered_content)
+            self.request.log.response = response.rendered_content.decode("utf-8")
         except Exception as w:
@jay-johnson
jay-johnson / red10-iris-sample-analysis.json
Created May 21, 2017 16:18
Red10 - IRIS Sample Analysis JSON
{
"analyses": [
{
"algo": {},
"analysis_json": {
"analysis": {
"AccuracyResults": {
"PetalLength": {
"AUROC": null,
"Accuracy": 0.9821328137134929,
@jay-johnson
jay-johnson / crontab for ntp syncing.rst
Created March 9, 2017 22:19
Cron job for syncing ntp - used when the install guides for ntp still do not work

Backing up a simple cron template I am using on a Fedora 24 machine that refuses to sync with ntp...This syncs it every 2 minutes:

# *    *    *    *    *  command to be executed
# ┬    ┬    ┬    ┬    ┬
# │    │    │    │    │
# │    │    │    │    │
# │    │    │    │    └───── day of week (0 - 7) (0 or 7 are Sunday, or use names)
# │    │    │    └────────── month (1 - 12)
@jay-johnson
jay-johnson / Steps.md
Created February 26, 2017 06:57 — forked from dblessing/Steps.md
Logstash + RabbitMQ HA attempt
  1. Configure RabbitMQ server clustering per https://www.rabbitmq.com/clustering.html.
  2. Configure at least one logstash agent to output to RabbitMQ. See config example:
output {
  rabbitmq {
    vhost => 'logstash'
    exchange => 'my_exchange'
    exchange_type => 'direct'
    host => 'logstashmq.example.com'
    key => 'my_key'
@jay-johnson
jay-johnson / xgboost-factory.rst
Last active February 19, 2017 19:10
Using XGBoost with the Sci-pype API
@jay-johnson
jay-johnson / list-vms.py
Last active December 2, 2016 22:02
Running commands on Windows 10 Home using pywinrm
#!/usr/bin/python
"""
An example for running commands on Windows 10 Home from a Linux host.
Here's the articles + steps I needed to prepare my Windows 10 Home machine:
https://github.com/diyan/pywinrm
$networkListManager = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"))