Skip to content

Instantly share code, notes, and snippets.

View pltrdy's full-sized avatar

Paul Tardy pltrdy

View GitHub Profile
@GhostofGoes
GhostofGoes / pyproject.toml
Last active August 27, 2024 11:15
Example pyproject.toml
# This example pyproject.toml is for a basic pip+setuptools setup.
# If you use a project management tool (like Poetry), then
# those tools will have slightly different configurations or additions.
# I highly recommend using a project management tool for your project.
# Project management is a highly opinionated subject.
# There are a lot of good, robust tools in this space now (as of 2023)
# Two that I've used and recommend are Poetry and PDM.
# Poetry is more mature, PDM is recent, both work well.
# - Poetry: https://python-poetry.org/
@etoosamoe
etoosamoe / docker-volume-transfer.md
Created April 6, 2023 08:39
How to transfer Docker Volumes to another host

Goal

You have docker volume on one host and want to move that volume to another host. For example, you want to transfer PostgreSQL container with it's volume to another host.

Solution

Actually, there is no in-a-box solution from Docker, so we need to:

  • attach our volume to another container
  • copy and archive all files
  • copy archive to another host
@mataney
mataney / finished_files_openntm_style.py
Created November 15, 2017 15:03
Using finished files to openNTM style
from tensorflow.core.example import example_pb2
import tensorflow as tf
import glob, struct
def text_generator(example_generator):
"""Generates article and abstract text from tf.Example.
Args:
example_generator: a generator of tf.Examples from file. See data.example_generator"""
while True:
@alrojo
alrojo / rnn_decoder_attention.md
Last active February 19, 2018 06:25
rnn_decoder_attention.md
from tensorflow.python.ops import tensor_array_ops
from tensorflow.python.framework import dtypes
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import variable_scope as vs
from tensorflow.python.ops import rnn
from tensorflow.python.ops import nn
from tensorflow.python.ops import init_ops
@andershammar
andershammar / matplotlib-zeppelin
Created July 1, 2015 07:42
Example showing how to use matplotlib from a Zeppelin notebook
%pyspark
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt
import StringIO
def show(p):
img = StringIO.StringIO()
p.savefig(img, format='svg')
@P7h
P7h / tmux__CentOS__build_from_source.sh
Last active May 2, 2024 01:27
tmux 2.0 and tmux 2.3 installation steps for Ubuntu. Or build from tmux source v2.5 for Ubuntu and CentOS.
# Steps to build and install tmux from source.
# Takes < 25 seconds on EC2 env [even on a low-end config instance].
VERSION=2.7
sudo yum -y remove tmux
sudo yum -y install wget tar libevent-devel ncurses-devel
wget https://github.com/tmux/tmux/releases/download/${VERSION}/tmux-${VERSION}.tar.gz
tar xzf tmux-${VERSION}.tar.gz
rm -f tmux-${VERSION}.tar.gz
cd tmux-${VERSION}
@jashkenas
jashkenas / semantic-pedantic.md
Last active September 5, 2024 17:03
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@netj
netj / memusg
Last active November 5, 2024 15:18
memusg -- Measure memory usage of processes
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <[email protected]>
# Created: 2010-08-16
############################################################################
# Copyright 2010 Jaeho Shin. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #