Skip to content

Instantly share code, notes, and snippets.

@gabrielhurley
gabrielhurley / gerrit_review_process.rst
Created December 27, 2011 21:07
How to send changes to gerrit for review

How to send changes to gerrit for review

This is an opinionated step-by-step guide for how to not screw up working with Gerrit as a code review tool.

This presumes a setup where you're working on a forked copy of the repository and have created an "upstream" remote repository which points to the original.

@lebedov
lebedov / ipc_demo.py
Created March 17, 2013 01:48
Demonstrate how to pass IPC handles to GPU data between processes in Python
#!/usr/bin/env python
"""
Demonstrate how to pass IPC handles to GPU data between processes in Python.
"""
import ctypes
import numpy as np
import multiprocessing as mp
import zmq
@gullitmiranda
gullitmiranda / README.md
Last active September 30, 2023 11:13
Remote support or pair programing cheet sheet with http://tmate.io
  1. Install http://tmate.io

  2. Configure ~/.tmux.conf

    curl -sSL -o ~/.tmux.conf https://gist.github.com/gullitmiranda/e631f14a66a8ff658eb7/raw/fc3cfb7cd2ef1cc6e5d0de66b1e93b68652de866/tmux.conf
  3. Start tmate server

@sykire
sykire / per_inline_model_converter.py
Last active April 9, 2021 07:16
Usually in flask-admin inline-models use the same converter. You can set a different converter setting 'inline_converter' in the ModelView but this will apply the same converter for every Model in the inline_models list.So I've overridden the 'scaffold_inline_form_models' method from ModelView just to check for every inline model in the list if …
from flask_admin.form import FormOpts
from flask_admin.contrib.sqla.form import InlineModelFormList, \
InlineModelConverter, \
get_form
from flask_admin.contrib.sqla.tools import get_primary_key
from flask_admin.contrib.sqla import ModelView
from flask_admin.model.fields import InlineModelFormField
from flask_admin.model.form import InlineFormAdmin
from flask_admin._compat import iteritems
@QuantumGhost
QuantumGhost / example.puml
Last active March 23, 2024 22:39
A simple template for PlantUML to draw ER diagram.The basic idea comes from http://plantuml.sourceforge.net/qa/?qa=331/database-modeling
@startuml
' uncomment the line below if you're using computer with a retina display
' skinparam dpi 300
!define Table(name,desc) class name as "desc" << (T,#FFAAAA) >>
' we use bold for primary key
' green color for unique
' and underscore for not_null
!define primary_key(x) <b>x</b>
!define unique(x) <color:green>x</color>
!define not_null(x) <u>x</u>
@jjo
jjo / kubectl-root-in-host-nopriv.sh
Last active February 5, 2024 23:07
Yeah. Get a root shell at any Kubernetes *node* via `privileged: true` + `nsenter` sauce. PodSecurityPolicy will save us. DenyExecOnPrivileged didn't (kubectl-root-in-host-nopriv.sh exploits it)
#!/bin/sh
# Launch a Pod ab-using a hostPath mount to land on a Kubernetes node cluster as root
# without requiring `privileged: true`, in particular can abuse `DenyExecOnPrivileged`
# admission controller.
# Pod command in turn runs a privileged container using node's /var/run/docker.sock.
node=${1}
case "${node}" in
"")
nodeSelector=''
podName=${USER+${USER}-}docker-any
@JTBrinkmann
JTBrinkmann / _extras.ps1
Last active April 20, 2019 17:22
configure a new Windows profile
# extra commandline utils
scoop install imagemagick python python2 bat caddy cmder dos2unix ffmpeg jq php sed
# extra GUI apps
scoop install jetbrains-toolbox gitkraken gimp atom sharex vlc autohotkey
# manually install whatever you need (e.g. Android Studio, IntelliJ, PHP-Storm)
jetbrains-toolbox
# install more programs using Chocolatey
@taikomatsu
taikomatsu / display_hdr_qt.py
Created May 29, 2019 17:33
Display hdr using PySide2
from PySide2 import QtWidgets, QtGui
from PySide2 import QtCore
import sys
import imageio
import numpy as np
from PIL import Image, ImageQt
imgpath = 'myhdri.hdr'
imageio.plugins.freeimage.download()
img = imageio.imread(imgpath)