Skip to content

Instantly share code, notes, and snippets.

View plar's full-sized avatar

Pavel Larkin plar

View GitHub Profile
/*
* net/balusc/webapp/FileServlet.java
*
* Copyright (C) 2009 BalusC
*
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
@plar
plar / django_register_application_permissions
Created March 6, 2015 20:14
Custom global permissions for Django v1.7.x without model
"""
Registers any number of application permissions without model
Examples:
# .../project/app/models.py
from django.apps import apps
register_application_permissions(
(
@plar
plar / golang.sh
Created January 20, 2016 21:00
Install Go v1.5.3 (Ubuntu 14.04/64)
#!/bin/bash
export GOLANG_VERSION=1.5.3
export GOLANG_DOWNLOAD_URL=https://storage.googleapis.com/golang/go$GOLANG_VERSION.linux-amd64.tar.gz
export GOLANG_DOWNLOAD_SHA256=43afe0c5017e502630b1aea4d44b8a7f059bf60d7f29dfd58db454d4e4e0ae53
apt-get update -qq
apt-get install -y --no-install-recommends \
g++ \
@plar
plar / Install Proxomox 4.4 on OVH(soyoustart) Debian 8.md
Last active November 29, 2021 19:28
OVH/Soyoustart Install Proxomox 4.4 over Debian 8 + ZFS

OVH (Soyoustart) - Install Proxomox 4.4 over Debian 8 + ZFS

Prepare your bare server

Select template

  1. Install template - Debian 8.7 stable (Jessie) (6.4)
  2. Select [ x ] Custom installation
# Chrome Extension Privacy Policy
Our extensions are fully self-contained, so we have no ability to collect any information when you use them.
@plar
plar / short_dir.py
Created June 8, 2018 20:27
Abbreviated current directory
#!/bin/env python3
import os
def short_cwd(cwd, max_len=55):
home = os.environ.get('HOME')
cwd = cwd.replace(home, '~')
if len(cwd) < max_len:
return cwd
@plar
plar / Manifest.txt
Last active January 11, 2023 18:17
Make Java JAR file self executable in linux
Manifest-version: 1.0
Created-By: 1.0 (https://github.com/plar)
Main-Class: hello.Main
@plar
plar / tf_diff.py
Last active August 1, 2018 16:26
tf_diff: Humanizing the output of `terraform plan` using python `difflib` module
#!/usr/bin/env python3
#
# `tf_diff` is a CLI tool for humanizing the output of `terraform plan` using python `difflib` module
# Requirements:
# 1. Python 3.x
# 2. If you want color output then you need to install a python module `colorama` (pip install colorama)
#
# Installation:
# Copy the file into your `bin` directory and make it executable (chmod u+x ~/bin/tf_diff)
#

Keybase proof

I hereby claim:

  • I am plar on github.
  • I am plarkin (https://keybase.io/plarkin) on keybase.
  • I have a public key whose fingerprint is ACC7 96BD DEFF 1703 DA7B 06CA A074 420D DADB 4427

To claim this, I am signing this object:

@plar
plar / ubuntu_disk_encryption.sh
Last active November 6, 2021 19:07
Ubuntu_Full_Disk_Encryption_Howto_2019 (shell commands)
sudo -i
export DEV="/dev/sda"
export DEV="/dev/nvme0n1"
export DM="${DEV##*/}"
export DEVP="${DEV}$( if [[ "$DEV" =~ "nvme" ]]; then echo "p"; fi )"
export DM="${DM}$( if [[ "$DM" =~ "nvme" ]]; then echo "p"; fi )"
# export SDD_PASS=secret123
sgdisk --print $DEV
sgdisk --zap-all $DEV