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"

@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.

@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
@felixcheruiyot
felixcheruiyot / dribbble.css
Created September 30, 2015 06:27
Create social media buttons with CSS3 gradients.
/*
Dribbble
------------------------------------------------------------ */
a.button-dribbble {
background-color: #c93764; /* fallback color */
background: -moz-linear-gradient(top, #ea4c89, #c93764);
background: -ms-linear-gradient(top, #ea4c89, #c93764);
background: -webkit-linear-gradient(top, #ea4c89, #c93764);
border: 1px solid #c93764;
# -*- coding: utf-8 -*-
import os
import StringIO
import hashlib
try:
from boto.s3.connection import S3Connection
from boto.s3.key import Key
except ImportError:
raise ImproperlyConfigured, "Could not load Boto's S3 bindings."