Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am programmerq on github.
* I am programmerq (https://keybase.io/programmerq) on keybase.
* I have a public key whose fingerprint is 217F E0C9 99DD CC3E D4AA A8CC 3727 2FAC 776F 319D
To claim this, I am signing this object:
@programmerq
programmerq / A simple image.md
Last active June 22, 2022 18:21
Simplest docker container

Step 1:

Create a statically linked executable.

(I happened to do it in a docker container. You could use any method to create a statically linked executable, really)

Source:

// hello.c

#include

$ cat testentrypoint.sh
#!/bin/bash
echo foobar
exec $@
$ ./testentrypoint.sh echo hello world
foobar
hello world
import mock
from unittest import TestCase
def expensive_function(x):
"""The function to be mocked. depending on how it is called, it may return
different data from the database, which can take a long time, which is why we
want to mock it."""
if x == 'greeting':
@programmerq
programmerq / gist:d0ca1cb58982c7806240
Last active August 29, 2015 14:24
Engineer Bitches Endlessly When Trying a New OS on His Laptop
When interviewed, Dan said that he decided to give Fedora another go. "It's
been nothing but problems. I know I can google shit, but it is easier to just
blame fedora." He added that deep down he knows that the keyboard shortcuts are
there, but since they are different than the ones he normally uses, he just
shouts at his coworkers that Fedora hates keyboard users.
His coworker, Brad, said that he just ignores Dan's unproductive rants most of
the time. "Occasionally, I will shout out the answer to him and make him feel
silly. He pretends not to, but I know he hears me-- he just stops talking for a
few minutes and that's all I really want."
$ docker run -d --name nginx nginx
$ docker run -p 80:80 --link nginx:backend -d --name hap -v `pwd`/hap.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro haproxy
$ curl `docker-machine ip dev`:80
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
tldr; use docker-machine to set up TLS for you. copy the client stuff to your jenkins container and then use it there.
First, provision a machine using docker-machine. It doesn't matter what driver you use, the end result is the same.
For a digitalocean box:
$ docker-machine create -d digitalocean \
--digitalocean-region sfo1 \
--digitalocean-size 2gb \
--digitalocean-access-token=abcdefgh1234567890345678 \
#!/bin/bash
curl -s 'https://sks-keyservers.net/pks/lookup?op=get&search=0xee6d536cf7dc86e2d7d56f59a178ac6c6238f52e' | apt-key add --import
apt-get update && apt-get install apt-transport-https
apt-get install -y linux-image-extra-virtual
echo "deb https://packages.docker.com/1.11/apt/repo ubuntu-xenial main" | tee /etc/apt/sources.list.d/docker.list
apt-get update && apt-get -y install docker-engine
@programmerq
programmerq / Dockerfile
Last active July 29, 2016 16:10
stunnel test
FROM alpine:edge
RUN apk --no-cache add stunnel
ADD stunnel.conf /stunnel.conf
CMD stunnel /stunnel.conf
@programmerq
programmerq / docker-compose.yml
Created August 31, 2016 20:12
extra_hosts example
version: "2"
services:
eh:
image: alpine
command: cat /etc/hosts
extra_hosts:
- "foo.com:1.2.3.4"