Skip to content

Instantly share code, notes, and snippets.

@jgram925
jgram925 / Elasticsearch-DSL: Analyzer Setup for Ngram Partial Search
Last active June 15, 2019 17:53
Elasticsearch-DSL: Analyzer Setup for Ngram Partial Search
@jgram925
jgram925 / Virtualenvwrapper: Set Django Settings Module
Last active June 15, 2019 17:52
Virtualenvwrapper: Set Django Settings Module
# envs/<project_name>/bin/postactivate
export DJANGO_SETTINGS_MODULE=<project_name>.<settings_folder_name>.<settings_file_name>
# envs/<project_name>/bin/postdeactivate
unset DJANGO_SETTINGS_MODULE
@jgram925
jgram925 / Elasticsearch-DSL Setup.md
Last active June 15, 2019 17:52
Elasticsearch-DSL Setup.md

Useful Commands

Create Index

This should only be used for testing. The index that will be used is created from the bulk_indexing method below.

curl -X PUT 'localhost:9200/<index_name>'

Check Indices

@jgram925
jgram925 / LibreNMS Setup.md
Last active June 15, 2019 17:52
LibreNMS Setup.md

LibreNMS is a network management system used to centralize monitoring of all network assets.

Setup

Follow the instructions provided HERE to setup the service.

Scanning for IP Devices

NOTE: python-ipaddress must be installed, use command below

@jgram925
jgram925 / Celery Tasks & Ajax Polling.md
Last active June 15, 2019 17:52
Celery Tasks & Ajax Polling.md

Django Celery Setup

Flower Celery Monitoring Utility Setup

This step is optional, but a nice way to keep the user informed. This button function notifies the user about the process and how to check the status. Then it will call the function below.

{{whatever_template_button_is_on}}.html

@jgram925
jgram925 / Ubuntu Web Server Setup.md
Last active June 24, 2019 23:34
Ubuntu Web Server Setup.md

Update & Upgrade Ubuntu

LINUX COMMAND: sudo apt-getupdate && sudo apt-get upgrade-y

Set a static IP address using netplan

  1. Navigate to /etc/netplan/

  2. Create a file name “01-netcfg.yaml”

@jgram925
jgram925 / Netplan - Set Static IP
Last active June 15, 2019 17:52
Netplan - Set Static IP
sudo nano /etc/netplan/01-netconf.yaml
network:
version: 2
renderer: networkd
ethernets:
ens33:
addresses: [10.6.0.84/16]
gateway4: 10.6.0.1
dhcp4: false
@jgram925
jgram925 / Django Channels 2.0 Setup.md
Last active June 15, 2019 17:51
Django Channels 2.0 Setup.md

Channels Installation & Setup

Used the Channels documentation to create these notes Channels Documentation.

Follow the Channels documentation's tutorial for a fuller walkthrough.

NOTE: This version of Channels only works with Python 3.5 or higher!

  1. Install Redis. this will handle the transactions between the websockets.
@jgram925
jgram925 / Django 2.1 Login.md
Last active June 15, 2019 17:51
Django 2.1 Login.md

settings.py

# Log In/Out Routing

LOGIN_REDIRECT_URL = 'chat'
LOGOUT_REDIRECT_URL = '/'

urls.py

Urls for Site, not App