Skip to content

Instantly share code, notes, and snippets.

_ _ _ ____ _ _
| | | | __ _ ___| | __ | __ ) __ _ ___| | _| |
| |_| |/ _` |/ __| |/ / | _ \ / _` |/ __| |/ / |
| _ | (_| | (__| < | |_) | (_| | (__| <|_|
|_| |_|\__,_|\___|_|\_\ |____/ \__,_|\___|_|\_(_)
A DIY Guide
@kojiwell
kojiwell / docker-shared-nw.md
Last active May 12, 2020 04:15
This is how to create a bridge between Docker containers and outside and create containers with the IP addresses you want to assign.

Docker - Create a Bridge and Shared Network

Sometimes I want to use Docker containers like regular VMs, creating a bridge on a Docker host, having containers on the same subnet with IP addresses I want to assign, and then logging into them via port 22. (No port forwarding, please.) So here's how to do it.

On this example, I use Vagrant and VirtualBox on my MacBook and create containers with IP addresses shown on the table below. Once you go through these steps, you should be able to extend the idea into your on-premises network.

@bcomnes
bcomnes / git-gpg.md
Last active December 14, 2024 13:50
my version of gpg on the mac
  1. brew install gnupg, pinentry-mac (this includes gpg-agent and pinentry)

  2. Generate a key: $ gpg --gen-key

  3. Take the defaults. Whatevs

  4. Tell gpg-agent to use pinentry-mac:

    $ vim ~/.gnupg/gpg-agent.conf 
    
# Auto list fields from django models - from https://djangosnippets.org/snippets/2533/#c5977
import inspect
from django.utils.html import strip_tags
from django.utils.encoding import force_text
def process_docstring(app, what, name, obj, options, lines):
# This causes import errors if left outside the function
from django.db import models
@vasanthk
vasanthk / System Design.md
Last active April 21, 2025 02:58
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@sterlingwes
sterlingwes / README.md
Created January 31, 2016 02:05
Converting a scanned PDF to EPUB ebook (or other format)

Caveat

You're not going to get a beautiful EPUB out the other end - if that's what you're looking for, expect to do some manual clean-up work yourself.

Basic order of operations:

  • Convert your PDF to an OCR-friendly format
  • OCR that shit into plaintext
  • Convert that plaintext into your format of choice (in this case, an EPUB)
@alexmorozov
alexmorozov / settings.py
Created January 11, 2016 19:55
Production raven config
INSTALLED_APPS += (
'raven.contrib.django.raven_compat',
)
MIDDLEWARE_CLASSES += (
'raven.contrib.django.raven_compat.middleware.Sentry404CatchMiddleware',
)
RAVEN_CONFIG = {
'dsn': 'http://x:[email protected]/2', # NOQA
@pirafrank
pirafrank / uninstall_office_2016.sh
Last active September 23, 2024 21:19
Uninstall Office 2016 from OS X completely
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo -e "
ROOT PRIVILEDGES NEEDED!
You have to run this script as root.
Aborting...
"
exit 1
else
@LSinev
LSinev / word_vs_latex_rus_tikz_pdfx.tex
Last active September 16, 2020 02:07
Word vs LaTeX image translated into russian, done by tikz code, compilable with pdflatex, xelatex and lualatex in PDF/X. Compilation in xelatex have to be done with commandline like (as PDF 1.3 required by PDF/X): "xelatex.exe -synctex=1 -interaction=nonstopmode -output-driver="xdvipdfmx -V 3 -z 0" --shell-escape %.tex"
% Úτƒ-8 encoded
% http://gist.github.com/LSinev/98c0a40e94f4507922a8
%%% Defining function to check compiler %%%
\RequirePackage{iftex}
\newif\ifxetexorluatex % new if operator (http://tex.stackexchange.com/a/47579/79756)
\ifXeTeX
\xetexorluatextrue
\else
\ifLuaTeX
\xetexorluatextrue
@galvanic
galvanic / README.md
Last active March 3, 2021 23:12
Plot a calendar in python using matplotlib.