Skip to content

Instantly share code, notes, and snippets.

View cnicodeme's full-sized avatar

Cyril Nicodème cnicodeme

View GitHub Profile
@cnicodeme
cnicodeme / fixes.md
Last active November 17, 2023 15:31
List of 5,000 Most Frequently Used Domain Name Prefixes and Suffixes - Ordered By Length
@cnicodeme
cnicodeme / pocket.py
Created April 4, 2020 17:35
Update your reading list by running this local script.
#!/usr/bin/python3
"""
This the CLI script to add tags to your reading list
You will need a Pocket application. You can create one at:
https://getpocket.com/developer/apps/new
/!\ Don't forget to set the variables defined after.
Requires Python3 and the "requests" library.
@cnicodeme
cnicodeme / sparkpost.py
Created March 11, 2020 15:44
Sparkpost script to send email using Flask
# -*- coding:utf-8 -*-
from flask import current_app
import mimetypes, requests, os
mimetypes.init()
def guess_mimetype(name):
type_found = mimetypes.guess_type(name)
@cnicodeme
cnicodeme / twitter.py
Created March 11, 2020 15:18
Custom implementation of the Twitter OAuth API.
# -*- coding:utf-8 -*-
from urllib.parse import parse_qs, quote
import oauth2, time, requests, json
"""
Usage:
# To setup the access:
# GET /twitter/authorize
@cnicodeme
cnicodeme / token.py
Last active October 9, 2019 12:05
Generates a sha256 hash of a username:password credentials for secured basic HTTP authentication.
#!/usr/bin/python
import sys, hashlib, base64
# USAGE: ./token.py "username" "password"
if len(sys.argv) != 3:
print("USAGE: script.py username password")
exit(1)
def generate(username, password):
return hashlib.sha256(base64.b64encode('{0}:{1}'.format(username, password).encode())).hexdigest()
@cnicodeme
cnicodeme / pdfshift.js
Created September 6, 2019 14:13
Browser side version of PDFShift conversion script.
// usage:
// pdfshift({'source': 'https://en.wikipedia.org/wiki/PDF', 'use_print': true}, 'your_api_key').then(...)
function pdfshift(data, apiKey) {
/**
* Javascript function for PDFShift
* @param apiKey: Your API key from PDFShift. Optional. Can be null
* @param data: Parameters to send to PDFShift. Must contains at least the "source"
*/
return new Promise(function (resolve, reject) {
@cnicodeme
cnicodeme / netlify.py
Created July 1, 2019 08:19
Deploy a ZIP archive to Netlify
#!/usr/bin/python
# -*- coding:utf-8 -*-
import zipfile, urllib2, argparse, os
try:
from BytesIO import BytesIO
except ImportError:
from io import BytesIO
@cnicodeme
cnicodeme / api.md
Last active July 11, 2022 09:17
ImprovMX documentation

ImprovMX API

This is the documentation of our API endpoint at ImprovMX.com. This lets you list, create, edit and remove domain and email aliases that you can forward to programatically.

For more information, visit ImprovMX.com

URL

The base url's ImprovMX api can be accessed at

@cnicodeme
cnicodeme / aiosmtpd.py
Created February 26, 2019 23:08
ImprovMX handler
import ssl
import socket
import asyncio
import logging
import collections
import time
from asyncio import sslproto
from email._header_value_parser import get_addr_spec, get_angle_addr
from email.errors import HeaderParseError
@cnicodeme
cnicodeme / links.md
Last active March 15, 2024 22:30
Big list of useful links