Skip to content

Instantly share code, notes, and snippets.

View manuelep's full-sized avatar

Manuele Pesenti manuelep

  • Gter (https://www.gter.it/)
  • Genova (GE)
View GitHub Profile
@manuelep
manuelep / scaffhold.sh
Last active April 9, 2020 21:47
web2py new scaffhold setup
#!/usr/bin/env bash
: s'
1. Clone a web2py repository
2. Checkout to the desidered version
3. Extract the scaffholding welcome application
4. Rename application (-)
5. Substitute some file:
@manuelep
manuelep / osmtaginfo.py
Last active November 27, 2019 21:27
OSM Tag info download
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
import requests, re
from builtins import str
def is_secondary(key, value):
if key in {'amenity'}:
@manuelep
manuelep / wc-free-checkout-fields.php
Last active March 18, 2019 15:25 — forked from bekarice/wc-free-checkout-fields.php
Simplify WooCommerce checkout fields for free checkouts
<?php // only copy if needed
/**
* Removes coupon form, order notes, and several billing fields if the checkout doesn't require payment.
*
* Tutorial: http://skyver.ge/c
*/
//function sv_free_checkout_fields() {
// first, bail if the cart needs payment, we don't want to do anything
if ( WC()->cart && WC()->cart->needs_payment() ) {
@manuelep
manuelep / .gitignore
Last active March 6, 2019 08:15
Progressive dump
*.ini
*.txt
*.log
@manuelep
manuelep / CASSAVA_INTEGRATION.md
Last active January 15, 2019 10:59
web2py patch to use WordPress with Cassava as CAS provider
@manuelep
manuelep / test_map.py
Created January 10, 2019 09:50 — forked from fdrcslv/test_map.py
test_map.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from swissknife.script import common_setup
import plotly.graph_objs as go
import plotly.io as pio
parser = argparse.ArgumentParser(
@manuelep
manuelep / test.py
Last active March 15, 2018 16:56
woocommerce webhook authemtication
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest, json
from woohook import *
class TestWoo(unittest.TestCase):
def test_authenticate(self):
@manuelep
manuelep / default.py
Last active April 1, 2020 13:00
authenticate woocommerce webhook
def compute(body):
secret = '<here is my secret key>'
dig = hmac.new(secret.encode(),
msg = body.encode(),
digestmod = hashlib.sha256
).digest()
computed = base64.b64encode(dig).decode()
return computed
@manuelep
manuelep / woocommerce_webhook_check.py
Created February 27, 2018 16:43
woocommerce webhook check
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import hmac
import hashlib
import base64
import unittest
import argparse
import logging
import sys
@manuelep
manuelep / wooapitest.py
Created February 26, 2018 16:34
wooapitest
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests, urlparse
import json
import argparse
import logging
parser = argparse.ArgumentParser(
description = """DOC""",