Skip to content

Instantly share code, notes, and snippets.

Avatar

Cyril Nicodème cnicodeme

View GitHub Profile
@cnicodeme
cnicodeme / langs.py
Last active Mar 4, 2021
Dictionnary of languages code (ISO-639-1) to their corresponding lang (Source: Wikpedia)
View langs.py
# Warning: This file looses the direction of the value (LTR/RTL)
#
{
"aa": "Afaraf",
"ab": "\u0410\u04a7\u0441\u0443\u0430",
"ae": "Avesta",
"af": "Afrikaans",
"ak": "Akan",
"am": "\u12a0\u121b\u122d\u129b",
@cnicodeme
cnicodeme / pdfshift.js
Created Dec 23, 2020
Convert a PDF using NodeJS and Axios
View pdfshift.js
const axios = require('axios');
const fs = require('fs');
function pdfshift(api_key, data) {
return new Promise((resolve, reject) => {
let asJson = false
if ('filename' in data || 'webhook' in data) {
asJson = true
}
@cnicodeme
cnicodeme / fixes.md
Last active Apr 16, 2021
List of 5,000 Most Frequently Used Domain Name Prefixes and Suffixes - Ordered By Length
View fixes.md
@cnicodeme
cnicodeme / pocket.py
Created Apr 4, 2020
Update your reading list by running this local script.
View pocket.py
#!/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 Mar 11, 2020
Sparkpost script to send email using Flask
View sparkpost.py
# -*- 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 Mar 11, 2020
Custom implementation of the Twitter OAuth API.
View twitter.py
# -*- 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 Oct 9, 2019
Generates a sha256 hash of a username:password credentials for secured basic HTTP authentication.
View token.py
#!/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 Sep 6, 2019
Browser side version of PDFShift conversion script.
View pdfshift.js
// 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 Jul 1, 2019
Deploy a ZIP archive to Netlify
View netlify.py
#!/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 Oct 7, 2019
ImprovMX documentation
View api.md

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