Skip to content

Instantly share code, notes, and snippets.

@jaysridhar
jaysridhar / ImageBatchConverter.py
Created Mar 23, 2021
Python Pillow example code for batch conversion of image files in a directory from one format (PNG, JPG, GIF, etc) to another.
View ImageBatchConverter.py
#!/usr/bin/python
import argparse, glob, os
from PIL import Image
formats = ["BMP", "DIB", "EPS", "GIF", "ICNS", "ICO", "IM", "JPG", "JPEG",
"J2K", "J2P", "JPX", "MSP", "PCX", "PNG", "PPM", "SGI",
"SPIDER", "TGA", "TIFF", "WebP", "XBM"]
parser = argparse.ArgumentParser(description="Pillow example - batch converter.")
parser.add_argument('-outdir', default='.', help='Directory to save converted image files')
@jaysridhar
jaysridhar / Squid-Installation-Ubuntu-18.04-from-source.md
Last active Feb 14, 2021
Installing Squid proxy on Ubuntu 18.04 by building from source
View Squid-Installation-Ubuntu-18.04-from-source.md

Installing prequisites

apt install g++
apt install make
apt install libssl1.0-dev

Building package

View Ubuntu-KVM-static-ip.md

Following netplan creates a virtual bridge br0 connected to interface enp2s0 and both have same mac address (as required by hetzner)

network:
  version: 2
  renderer: networkd
  ethernets:
    enp2s0:
      match:
@jaysridhar
jaysridhar / Ubuntu-KVM.md
Last active Feb 11, 2021
Setting up virtual machines on Ubuntu using KVM
View Ubuntu-KVM.md

Started with Ubuntu 18.04 LTS minimal install on KVM host

Installed the following KVM related packages

Running as root, obviously:

apt install -y qemu-kvm libvirt-bin bridge-utils virtinst
@jaysridhar
jaysridhar / CSV.java
Last active Nov 27, 2020
Java CSV Reader module. Drop into any project and use. Supports Excel compatible CSV (multi-line columns, etc).
View CSV.java
package sample;
import java.io.InputStream;
import java.io.PushbackInputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.BufferedReader;
import java.util.List;
import java.util.ArrayList;