Skip to content

Instantly share code, notes, and snippets.

View shalomz's full-sized avatar

Shalom Nyende shalomz

View GitHub Profile
@shalomz
shalomz / nagios
Created February 4, 2018 15:15 — forked from smukkejohan/nagios
Nagios with Nginx configuration
server {
listen 80;
server_name nagios.example.tld;
access_log /var/log/nginx/nagios.access.log;
error_log /var/log/nginx/nagios.error.log info;
expires 31d;
root /usr/share/nagios3/htdocs;
@shalomz
shalomz / url_patterns.py
Created February 6, 2018 10:34 — forked from c4urself/url_patterns.py
URL Patterns with Optional Arguments
(r'^articles/(?P<year>\d{4}/?$, 'main.views.year'),
# When a use case comes up that a month needs to be involved as
# well, you add an argument in your regex:
(r'^articles/(?P<year>\d{4}/(?P<month>\d{2})/?$, 'main.views.year_month'),
# That works fine, unless of course you want to show something
# different for just the year, in which case the following case can be
# used, making separate views based on the arguments as djangoproject
@shalomz
shalomz / 01_models.py
Created February 8, 2018 11:25 — forked from dimi-tree/01_models.py
Django REST Framework: understaning ModelSerializer
from django.db import models
class Member(models.Model):
# RE: null vs blank
#
# NULL https://docs.djangoproject.com/en/1.10/ref/models/fields/#null
# Avoid using null on string-based fields such as CharField and TextField because
# empty string values will always be stored as empty strings, not as NULL.
#
#!/bin/env python
import sys
import SocketServer
import BaseHTTPServer
import SimpleHTTPServer
class ThreadingSimpleServer(SocketServer.ThreadingMixIn,
BaseHTTPServer.HTTPServer):
@shalomz
shalomz / Render_to_XLS.py
Created May 7, 2018 14:45 — forked from martync/Render_to_XLS.py
Output an XLS file with XLWT
from django.template import Variable, defaultfilters
from django.http import HttpResponse
import xlwt
def render_to_xls(queryset, filename, fields):
"""
Output an XLS file of the queryset
Usage :
-------
@shalomz
shalomz / snakecoin-server-full-code.py
Created May 18, 2018 09:08 — forked from aunyks/snakecoin-server-full-code.py
The code in this gist isn't as succinct as I'd like it to be. Please bare with me and ask plenty of questions that you may have about it.
from flask import Flask
from flask import request
import json
import requests
import hashlib as hasher
import datetime as date
node = Flask(__name__)
# Define what a Snakecoin block is
class Block:

Keybase proof

I hereby claim:

  • I am shalomz on github.
  • I am gunicorn (https://keybase.io/gunicorn) on keybase.
  • I have a public key ASDHdzKL2B58O6NJIKXryXKBofrnxvSptrzvTR9kuZj2SAo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am shalomz on github.
  • I am gunicorn (https://keybase.io/gunicorn) on keybase.
  • I have a public key ASBfHBPWtp9SHkQl9C1kivUEu82TenNdcYQoejKpN5kPlQo

To claim this, I am signing this object:

@shalomz
shalomz / index.html
Created June 25, 2018 08:10
Real Time Moon
<div id="earth">
<svg class="box" width="500px" height="500px" viewBox="0 0 356 445" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<filter x="-21.4%" y="-18.1%" width="142.7%" height="142.7%" filterUnits="objectBoundingBox" id="filter-1">
<feOffset dx="0" dy="9" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="18.5" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1" result="shadowMatrixOuter1"></feColorMatrix>
<feMerge>
<feMergeNode in="shadowMatrixOuter1"></feMergeNode>
<feMergeNode in="SourceGraphic"></feMergeNode>
@shalomz
shalomz / index.haml
Created June 25, 2018 08:14
Infinity glowline CSS corners box / buttons
%div.wrapper
%div.bttn.out.cyan
%span Infiniti
%div.corners.top
%div.corners.bottom
%div.bttn.in
%span Infinity
%div.corners.top
%div.corners.bottom