Skip to content

Instantly share code, notes, and snippets.

View Petelin's full-sized avatar

lin Petelin

View GitHub Profile
@radlinskii
radlinskii / pre-commit.sh
Last active October 5, 2022 15:56
pre-commit git hook file for working in Go. Be sure to save this file in your repository as `.git/hooks/pre-commit` and give it right to execute e.g. with command `chmod +x .git/hooks/pre-commit`
#!/bin/sh
STAGED_GO_FILES=$(git diff --cached --name-only | grep ".go$")
if [[ "$STAGED_GO_FILES" = "" ]]; then
exit 0
fi
GOLINT=$GOPATH/bin/golint
GOIMPORTS=$GOPATH/bin/goimports
@hartror
hartror / limit.py
Created December 23, 2014 03:21
Finding safe ways to limit a forked proccess's memory in Python.
#!/usr/bin/env python
import os
import psutil
import resource
import subprocess
import sys
import time