Skip to content

Instantly share code, notes, and snippets.

Lorenz Lo Sauer lsauer

Block or report user

Report or block lsauer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dweldon
dweldon / install-docker.sh
Last active Jan 19, 2020
Install docker CE on Linux Mint 18.3
View install-docker.sh
#!/usr/bin/env bash
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
sudo apt-get update
sudo apt-get install docker-ce
# https://docs.docker.com/compose/install/
@kekru
kekru / 1-Enable Docker Remote API with TLS client verification.md
Last active Feb 11, 2020
Docker Remote API with client verification via daemon.json
View 1-Enable Docker Remote API with TLS client verification.md

Enable Docker Remote API with TLS client verification

Docker's Remote API can be secured via TLS and client certificate verification.
First of all you need a few certificates and keys:

  • CA certificate
  • Server certificate
  • Server key
  • Client certificate
  • Client key

Create certificate files

@soheilhy
soheilhy / nginxproxy.md
Last active Feb 13, 2020
How to proxy web apps using nginx?
View nginxproxy.md

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@goldhand
goldhand / recursiveness
Created Aug 15, 2013
Things I learned dealing with JSON trees in django
View recursiveness
# Things I learned dealing with recursive JSON objects
This is a summary of my findings while dealing with a django model, TaskCategory.
## Two ways for manipulating a set of trees
I found two different ways for manipulating objects with an uncertain amount
of ascendants / descendants. The first involves manipulating an object within
a tree and the second involves taking apart the tree, manipulating the branches
and building a new tree
@edw
edw / heroku-pg-dump-schema.sh
Last active May 31, 2019
Dump a schema from a Heroku app's database.
View heroku-pg-dump-schema.sh
#!/bin/sh
# Usage: heroku-pg-dump-schema.sh HEROKU-APP-NAME DB-ENV-VAR-NAME SCHEMA-NAME
app=$1
env_var=$2
schema=$3
db_url=`heroku config -s --app ${app} | grep ${env_var}`
@lsauer
lsauer / InChi.js
Created Oct 25, 2011
Regular Expressions for validating SMILES, InChi, InChiKey
View InChi.js
// International Chemical Identifier Regex, by lo sauer - lsauer.com
// Morphine InchI:
var x="InChI=1S/C17H19NO3/c1-18-7-6-17-10-3-5-13(20)16(17)21-15-12(19)4-2-9(14(15)17)8-11(10)18/h2-5,10-11,13,16,19-20H,6-8H2,1H3/t10-,11+,13-,16-,17-/m0/s1"
// applying an organic character-subset
// we could check for the length property, but in case of 0 matches 'null' is returned -> hence !!.. \ generally equal to Boolean(..)
!!x.trim().match(/^((InChI=)?[^J][0-9BCOHNSOPrIFla+\-\(\)\\\/,pqbtmsih]{6,})$/ig)
>true
//generic:
x.trim().match(/^((InChI=)?[^J][0-9a-z+\-\(\)\\\/,]+)$/ig)
@timbroder
timbroder / gist:1209944
Created Sep 11, 2011
insert update url rewrite
View gist:1209944
#INSERT INTO `core_url_rewrite` (`store_id`, `category_id`, `product_id`, `id_path`, `request_path`, `target_path`, `is_system`)
SELECT 1 AS `store_id`,
`sub`.`category_id`,
`sub`.`entity_id` AS `product_id`,
CONCAT('product', '/', `entity_id`, '/', `category_id`) AS `id_path`,
`value` AS `request_path`,
CONCAT('catalog/product/view/id/', `entity_id`, '/category/', `category_id`) AS `target_path`,
1 AS `is_system`
FROM
(SELECT
@kzk
kzk / evhttp-multh-thread-httpd.cpp
Created Nov 6, 2010
Multi-Threaded HTTPServer using evhttp
View evhttp-multh-thread-httpd.cpp
#include <event.h>
#include <evhttp.h>
#include <pthread.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <iostream>
@leandrosilva
leandrosilva / Client.cs
Created Oct 31, 2010
Asynchronous Client/Server Socket Example with C# (from MSDN library)
View Client.cs
// Asynchronous Client Socket Example
// http://msdn.microsoft.com/en-us/library/bew39x2a.aspx
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Text;
// State object for receiving data from remote device.
You can’t perform that action at this time.