Skip to content

Instantly share code, notes, and snippets.

@akozlenkov
akozlenkov / Dockerfile
Last active March 23, 2021 09:13
Установка home-assistant на wirenboard
FROM arm32v7/debian:stretch as builder
RUN apt-get update && apt-get install -y wget build-essential libffi-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev libffi-dev uuid-dev tk-dev
RUN wget -qO- https://github.com/openssl/openssl/archive/OpenSSL_1_1_1j.tar.gz | tar -xz -C /usr/src/
RUN cd /usr/src/openssl-OpenSSL_1_1_1j && ./config -Wl,-Bsymbolic-functions -fPIC shared --prefix=/usr/local/openssl && make && make install && tar cvfz /openssl-1.1.1j.tar.gz /usr/local/openssl
ENV CFLAGS="-I/usr/local/openssl/include" LDFLAGS="-L/usr/local/openssl/lib" LD_LIBRARY_PATH="/usr/local/openssl/lib" PATH="/usr/local/openssl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
@imantung
imantung / ast_print_struct_fields.go
Created June 3, 2020 11:07
Print struct field using golang AST
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
)
var src = `package mypackage
@ezimuel
ezimuel / sign.sh
Created March 14, 2016 15:50
Sign and verify a file using OpenSSL command line tool. It exports the digital signature in Base64 format.
#!/bin/bash
# Sign a file with a private key using OpenSSL
# Encode the signature in Base64 format
#
# Usage: sign <file> <private_key>
#
# NOTE: to generate a public/private key use the following commands:
#
# openssl genrsa -aes128 -passout pass:<passphrase> -out private.pem 2048
# openssl rsa -in private.pem -passin pass:<passphrase> -pubout -out public.pem
@suicide
suicide / artifactory-get.sh
Last active September 10, 2023 14:27
Downloads latest artifact version from artifactory
#!/bin/bash
# downloads latest version of an artifact from artifactory
set -e
usage(){
echo "Usage: $*" >&2
exit 64
}
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@spikebike
spikebike / client.go
Created March 29, 2012 01:13
TLS server and client
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)
@brendano
brendano / xlsx2tsv.py
Created November 7, 2008 02:53
xlsx2tsv: python command-line script to convert xlsx (Excel "OOXML") into tab-separated values
#!/usr/bin/env python
"""
xlsx2tsv filename.xlsx [sheet number or name]
Parse a .xlsx (Excel OOXML, which is not OpenOffice) into tab-separated values.
If it has multiple sheets, need to give a sheet number or name.
Outputs honest-to-goodness tsv, no quoting or embedded \\n\\r\\t.
One reason I wrote this is because Mac Excel 2008 export to csv or tsv messes
up encodings, converting everything to something that's not utf8 (macroman