Skip to content

Instantly share code, notes, and snippets.

View felixcheruiyot's full-sized avatar

FELIX CHERUIYOT felixcheruiyot

View GitHub Profile
@felixcheruiyot
felixcheruiyot / setup_clightning.md
Created December 29, 2022 11:41 — forked from Stadicus/setup_clightning.md
Setup c-lightning on Digital Ocean

E-Commerce c-lightning node on Digital Ocean

Prerequisites

  • based on small Digital Ocean VPS (1CPU / 1GB RAM) with Ubuntu 16.04
  • SSH keys are recommended, but not described here
  • (sub) domain name necessary for SSL certificate

UFW & basic stuff

Login as "root"

{
"institution": 1,
"template_id": 1,
"document_type": "PR",
"date_issued": "2021-08-03",
"number": "2019751824053621",
"pin_code": "2019751824053621",
"pin_category": "SCHOOL FEES",
"payment_amount": 1000,
"payment_currency": "NGN",
@felixcheruiyot
felixcheruiyot / ssl-check.py
Created September 13, 2020 19:01 — forked from gdamjan/ssl-check.py
Python script to check on SSL certificates
# -*- encoding: utf-8 -*-
# requires a recent enough python with idna support in socket
# pyopenssl, cryptography and idna
from OpenSSL import SSL
from cryptography import x509
from cryptography.x509.oid import NameOID
import idna
from socket import socket
@felixcheruiyot
felixcheruiyot / FingerPrintMiddleware.py
Created May 1, 2020 04:42 — forked from Cediddi/FingerPrintMiddleware.py
Django Middleware for fingerprinting browsers server-side. Useful for expiring auth tokens.
"""
#Disclaimer
- Use with caution
- Don't be evil
- Respect your users
"""
class FingerPrintMiddleware(object):
def process_request(self, request):
import hashlib
@felixcheruiyot
felixcheruiyot / serializers.py
Created November 5, 2019 15:29 — forked from orehush/serializers.py
DRF simple JWT logout flow
from django.utils.text import gettext_lazy as _
from rest_framework import serializers
from rest_framework_simplejwt.tokens import RefreshToken, TokenError
class RefreshTokenSerializer(serializers.Serializer):
refresh = serializers.CharField()
default_error_messages = {
'bad_token': _('Token is invalid or expired')
}
@felixcheruiyot
felixcheruiyot / Large-app-how-to.md
Created August 13, 2019 15:56 — forked from cuibonobo/Large-app-how-to.md
How to structure a large application in Flask. Taken from the Flask wiki: https://github.com/mitsuhiko/flask/wiki/Large-app-how-to

Here's an example application that uses the pattern detailed below: https://github.com/tantastik/talent-curator


This document is an attempt to describe the first step of a large project structure with flask and some basic modules:

  • SQLAlchemy
  • WTForms

Please feel free to fix and add your own tips.

{
"name": "vbvcomplete",
"data": {
"data": {
"status": "successful",
"txRef": "shop",
"amount": "5000"
}
},
"respcode": "00",
@felixcheruiyot
felixcheruiyot / docker-cleanup-resources.md
Created April 9, 2018 16:47 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@felixcheruiyot
felixcheruiyot / AcademicRegistry.sol
Created January 18, 2018 16:42 — forked from anonymous/AcademicRegistry.sol
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.19+commit.c4cbbb05.js&optimize=false&gist=
pragma solidity ^0.4.16;
contract AcademicRegistry {
address admin;
enum Permissions {
CanEnrollCandidate,
CanUpdateProgram,
CanUpdateUnits,
CanUpdateStaff,
CanClearCandidate,

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream