Skip to content

Instantly share code, notes, and snippets.

shouro /
Created Jan 28, 2020 — forked from dkarchmer/
Example of a Django Rest Framework ViewSet with nested views
# ViewSets define the view behavior.
class FooViewSet(viewsets.ModelViewSet):
lookup_field = 'slug'
queryset = Foo.objects.all()
serializer_class = FooSerializer
def get_queryset(self):
This view should return a list of all records
shouro /
Created Sep 29, 2019 — forked from bradtraversy/
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh brad@

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

shouro /
Created May 4, 2018 — forked from solarce/ example template for ec2 instance with tags
# The various ${} come from
# Specify the provider and access details
provider "aws" {
region = "${var.aws_region}"
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
shouro /
Created May 4, 2018 — forked from moertel/
Try Vault with MySQL storage backend (via Docker)

Initialise (will return keys and a token)

curl -X PUT --data '{"secret_shares":1, "secret_threshold":1}'

Use one of the keys to unseal

curl -X PUT --data '{"key":"a5e665962f544dd16471c120c5500a7906cfbaeb3f18ae0fc6c5c71d444f0a90"}'

Use the root token to store something

shouro / nginx.conf
Created Apr 26, 2017 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
# bash generate random alphanumeric string
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
shouro /
Created Jan 26, 2016 — forked from andreif/
A simple unix/linux daemon in Python

A simple unix/linux daemon in Python



by Sander Marechal

I've written a simple Python class for creating daemons on unix/linux systems. It was pieced together for various other examples, mostly corrections to various Python Cookbook articles and a couple of examples posted to the Python mailing lists. It has support for a pidfile to keep track of the process. I hope it's useful to someone.

shouro / gist:c8d14c42f085a9a11928
Created Jan 19, 2016
Python AES two-way encryption/decryption example
View gist:c8d14c42f085a9a11928
from Crypto.Cipher import AES
import base64
import os
# the block size for the cipher object; must be 16, 24, or 32 for AES
# the character used for padding--with a block cipher such as AES, the value
# you encrypt must be a multiple of BLOCK_SIZE in length. This character is
# used to ensure that your value is always a multiple of BLOCK_SIZE
import os
from autobahn.resource import WebSocketResource, WSGIRootResource
from autobahn.websocket import WebSocketServerFactory, WebSocketServerProtocol
from flask import Flask, render_template
from twisted.application import internet, service
from twisted.internet import reactor
from twisted.python.threadpool import ThreadPool
from twisted.web.server import Site
shouro /
Last active May 24, 2019
This python script will list your public and private gist.

List git gist

This script will print the output in HTML format on stdout.

Console command

$ python > out.html

You can’t perform that action at this time.