Skip to content

Instantly share code, notes, and snippets.

View gglanzani's full-sized avatar

Giovanni Lanzani gglanzani

View GitHub Profile
@gglanzani
gglanzani / opengraph.html
Created March 14, 2024 11:19
opengraph.html with hugo{
{{- if .IsPage }}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
<meta property="article:section" content="{{ .Section }}" />
{{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
{{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
{{- end -}}
{{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }}
{{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }}
{{- with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }}
@gglanzani
gglanzani / app.conf
Last active April 20, 2022 11:48
miniflux, docker-compose, nginx
server {
listen 80;
server_name <my_domain>;
server_tokens off;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
"""
When deploying new jars used by NiFi's ExecuteScript processor, it is necessary to stop and restart all the
processors manually to have them pick up the new jars. This script solves this issue.
"""
import json
from urllib import request
from urllib import error
from typing import Dict, Iterator, List
from http.client import HTTPResponse
@gglanzani
gglanzani / index.html
Last active June 16, 2017 09:51
accelerator tshirt
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css">
<script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script>
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style>
<body>
<div style="max-width:900px; -webkit-transform:rotate(0deg)">
<scene id="scene1">
@gglanzani
gglanzani / .theanorc
Created October 3, 2016 07:41
Theano + CUDA on Windows
[general]
device=gpu
floatX=float32
[cuda]
root=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0
[nvcc]
compiler_bindir=C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin
[lib]
cnmem=0.2
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gglanzani
gglanzani / erlang-shell
Created January 13, 2015 11:16
riak-python-client#396
riakc_pb_socket:mapred( Client, [
{<<"SCF">>,<<"satellite_00BCD806247A70C80E9780BBC274C42CB06F3047E03CABC0652F72FB0A2C55A0_False_2013-1">>},
{<<"SCF">>,<<"satellite_00BCD806247A70C80E9780BBC274C42CB06F3047E03CABC0652F72FB0A2C55A0_False_2013-3">>},
{<<"SCF">>,<<"satellite_00BCD806247A70C80E9780BBC274C42CB06F3047E03CABC0652F72FB0A2C55A0_False_2013-4">>},
{<<"SCF">>,<<"satellite_00BCD806247A70C80E9780BBC274C42CB06F3047E03CABC0652F72FB0A2C55A0_False_2013-5">>},
{<<"SCF">>,<<"satellite_00BCD806247A70C80E9780BBC274C42CB06F3047E03CABC0652F72FB0A2C55A0_False_2013-6">>},
{<<"SCF">>,<<"satellite_00BCD806247A70C80E9780BBC274C42CB06F3047E03CABC0652F72FB0A2C55A0_False_2013-7">>},
{<<"SCF">>,<<"satellite_00BCD806247A70C80E9780BBC274C42CB06F3047E03CABC0652F72FB0A2C55A0_False_2013-8">>},
from riak import RiakClient
from riak import RiakMapReduce
riak = RiakClient(protocol='pbc', host='172.17.12.22', http_port=8087)
bucket = riak.bucket("STATS")
mr = RiakMapReduce(riak)
keys = [d['_yz_rk'] for d in bucket.search(query="industry_id:[1 TO 22]", index="grid_stats", rows=1000)['docs']]
mr.add("STATS", keys[:40])
len(set(map(lambda x: x[:-5], keys[:40]))) # number of unique keys, 31 in this case

Keybase proof

I hereby claim:

  • I am gglanzani on github.
  • I am lanzani (https://keybase.io/lanzani) on keybase.
  • I have a public key whose fingerprint is D495 85D1 CBD3 BD0B BB17 C8B6 C2AA C094 1858 6A16

To claim this, I am signing this object:

@gglanzani
gglanzani / macvim
Last active August 29, 2015 13:59
brew install -v macvim 2>&1
~/C/scala-training ⮀ brew doctor
Your system is ready to brew.
~/C/scala-training ⮀ br
Updated Homebrew from 87500fdb to 120b1658.
==> New Formulae
sysdig
==> Updated Formulae
clens freerdp libdvdcss phantomjs
cloudfoundry-cli gforth midnight-commander sshguard
~/C/scala-training ⮀ brew --config