Skip to content

Instantly share code, notes, and snippets.

View mjul's full-sized avatar

Martin Jul mjul

View GitHub Profile
@mjul
mjul / GPG-FIX.md
Created November 18, 2022 19:02
gpg: signing failed: Inappropriate ioctl for device

Fixing GPG "Inappropriate ioctl for device" errors

6th November 2016 Linux 24 Comments https://d.sb/B5N 
    Error: gpg: using "D5673F3E" as default secret key for signing 
    Error: gpg: signing failed: Inappropriate ioctl for device 
    Error: gpg: [stdin]: sign+encrypt failed: Inappropriate ioctl for device
@mjul
mjul / kalender.ipynb
Last active August 28, 2023 03:17
Create secondary x-axis with date and days since start in Matplotlib
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mjul
mjul / docker-compose.yml
Created April 4, 2018 11:05
Elastic Search, Logstash and Kibana via docker-compose for parsing key=value style log files
version: '2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.2
volumes:
- esdata:/usr/share/elasticsearch/data
ports:
- "9200:9200"
@mjul
mjul / aws_env
Created July 8, 2016 13:32
Get environment variables from AWS profile (for use with docker-machine)
#!/bin/sh
# Set the AWS environment variables for an AWS profile
# Useful for docker-machine
#
# Example:
#
# aws_env profile-for-testing
#
# Further information:
# See the AWS CLI `aws configure`
@mjul
mjul / Dockerfile
Created June 2, 2016 08:53
Running R scripts in a Docker container
FROM r-base:latest
COPY . /usr/local/src/myscripts
WORKDIR /usr/local/src/myscripts
CMD ["Rscript", "myscript.R"]
@mjul
mjul / form_to_opencv.py
Created July 2, 2014 19:27
Decode Python (Flask or Werkzeug) photo file uploaded via HTTP POST request in-memory to an OpenCV matrix.
#
# Example from code built on the Flask web framework (and Werkzeug)
# Accepts uploading a photo file in the 'photo' form member, then
# copies it into a memory byte array and converts it to a numpy array
# which in turn can be decoded by OpenCV.
#
# Beware that this increases the memory pressure and you should
# configure a max request size before doing so.
#
# It saves a round-trip to a temporary file, though.
@mjul
mjul / elasticsearch.fsx
Last active June 1, 2022 08:15
Elasticsearch in F# example
// paket add nuget NEST
#I "../../packages"
#r "Elasticsearch.Net/lib/net46/Elasticsearch.Net.dll"
#r "NEST/lib/net46/Nest.dll"
open System
//open Elasticsearch.Net
open Nest
@mjul
mjul / DynamicLookup.cs
Created May 28, 2013 09:07
Using C# dynamic type to navigate a dictionary via dynamically generated properties corresponding to the dictionary's keys.
protected override University MapFromRow(Row input)
{
// Using dynamic so we can hit the TryGetMember on Row to look up
// missing properties (here: all of them) in the key-value map.
dynamic row = input;
return new University()
{
UniversityNumber = Int32.Parse(row.UniversityNumber),
Name = row.UniversityName,
};
@mjul
mjul / 02_nginx_gzip_configuration.config
Last active November 6, 2020 03:29
Enable gzip compression in Elastic Beanstalk Docker nginx proxy (add to .ebextensions folder)
files:
"/etc/nginx/conf.d/gzip.conf":
mode: "644"
owner: "root"
group: "root"
content: |
# enable gzip compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
@mjul
mjul / convert-visio-drawings-to-pdf.ps1
Created March 21, 2013 11:10
Convert the Visio drawings in the current directory to PDF
# Convert Visio (2013) documents to PDF
$drawings = Get-ChildItem -Filter "*.vsdx"
Write-Host "Converting Visio documents to PDF..." -ForegroundColor Cyan
try
{
$visio = New-Object -ComObject Visio.Application
$visio.Visible = $true