Skip to content

Instantly share code, notes, and snippets.

View blankdots's full-sized avatar
:octocat:
keyboard bashing ⌨️ 🔨

Stefan Negru blankdots

:octocat:
keyboard bashing ⌨️ 🔨
View GitHub Profile
@viklund
viklund / Dockerfile
Last active December 3, 2019 13:37
Crypt4gh docker experiments
FROM debian:10-slim
## Otherwise Java won't install
RUN mkdir -p /usr/share/man/man1
RUN apt-get update \
&& apt-get install -y gnupg2
## This is to get openjdk-11-jre to install on -slim
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EA8CACC073C3DB2A
{
"builders": [
{
"type": "amazon-ebs",
"region": "us-west-2",
"instance_type": "t2.micro",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "CIS Microsoft Windows Server 2016 Benchmark v1.1.0.*Level 1*",
@lukassup
lukassup / zipapp.md
Last active September 12, 2023 02:17
Python zipapp

Python zipapp web apps

What's a zipapp?

This concept is very much like .jar or .war archives in Java.

NOTE: The built .pyz zipapp can run on both Python 2 & 3 but you can only build .pyz zipapps with Python 3.5 or later.

Initial setup

@obskyr
obskyr / stream_response.py
Last active April 2, 2024 09:53
How to stream a requests response as a file-like object.
# -*- coding: utf-8 -*-
import requests
from io import BytesIO, SEEK_SET, SEEK_END
class ResponseStream(object):
def __init__(self, request_iterator):
self._bytes = BytesIO()
self._iterator = request_iterator
@blaisep
blaisep / jenkins-pipeline-git-cred.md
Created October 20, 2016 23:33
Insert git credentials into Jenkins Pipeline Script projects

Suppose you want to inject a credential into a Pipeline script. The cloudbees note does not include Pipeline script examples. https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs

The Jenkins Pipeline Docs' description of the git pushmethod doesn't have an example using injected credentials. (https://jenkins.io/doc/pipeline/examples/#push-git-repo)

The Snippet generator is helpful, but not not if you try to follow the instructions at: https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Binding+Plugin

@vielhuber
vielhuber / script.sh
Last active April 25, 2024 19:10
PostgreSQL: Backup and restore export import pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
*:5432:*:username:password
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
*:5432:*:username:password
# linux
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@sebasmagri
sebasmagri / falcon_gevent_streaming.py
Created November 10, 2014 13:08
Concurrently streaming response using Falcon and Gevent
# Fire this using gunicorn falcon_gevent_streaming
# and head to 127.0.0.1:8000 in a browser.
# Requirements:
# pip install falcon gevent
import falcon
import gevent
from gevent.queue import Queue
@asizer
asizer / README.md
Last active November 8, 2019 07:37
d3 Horizontal BoxPlot

This sample is based on Mike Bostock's Box Plots. The box.js file has been modified in a number of ways besides making the box plots horizontal: the transitions have been removed, the 1.5 iqr function is included as the default to compute the whisker length, data objects are attached to the whisker ends and outlier dots (instead of just the values), and there are transparent q1-q2 and q2-q3 boxes that contain those respective data points for possible future use.

Hovering over outlier dots in the boxplot highlights them on the table and vice-versa. This also demonstrates a move-to-front functionality -- when an outlier circle is highlighted, it is moved to the end of the svg's elements so that it appears on top of the other outliers.

Also, the axis rounds its range to intervals that go into a power of 10 (see the cleanUpChartRange function).

The variable being plotted is a generated logNoraml distribution, to demonstrate outliers more prominently (sometimes there are so many, the table gets cut

@jprante
jprante / skos-label-example.sh
Created November 19, 2013 19:34
An example of broader/narrower SKOS for Elasticsearch SKOS plugin
curl -XDELETE 'localhost:9200/test'
curl -XPOST 'http://localhost:9200/test' -d '{
"settings" : {
"index" : {
"analysis" : {
"filter": {
"skosfilter" : {
"type": "skos",
"path": "/var/tmp/indexpath/",