Skip to content

Instantly share code, notes, and snippets.

View tlatsas's full-sized avatar

Tasos Latsas tlatsas

View GitHub Profile
#!/usr/bin/env python3
# average-incident.py
# requires python >= 3
import os
import sys
import math
import csv
import itertools
@tlatsas
tlatsas / random6points.sh
Created May 17, 2013 15:23
read a point csv and return 6 random points in csv format
#!/bin/sh
echo "Latitude,Longitude,Heading"
tail -n+2 "$1" | shuf -n 6
@tlatsas
tlatsas / reports2csv.sh
Created May 17, 2013 15:15
incident locator reports data -> csv
#!/bin/sh
echo "Latitude,Longitude,Heading"
while read line; do
echo $line | cut -f1-3 -d' '|sed 's/°//'|tr ' ' ','
done < "$1"
@tlatsas
tlatsas / Makefile
Created April 15, 2013 14:15
latexmk Makefile
LATEXMK = latexmk
.PHONY: pdf
all: pdf
pdf:
$(LATEXMK) -pdf -pdflatex="pdflatex -interactive=nonstopmode"
clean:
@tlatsas
tlatsas / Makefile
Created April 15, 2013 14:05
latex makefile
LATEX = latex
BIBTEX = bibtex
PS2PDF = ps2pdf
DVIPS = dvips
DVI_VIEWER = xdvi
PS_VIEWER = evince
PDF_VIEWER = evince
PS2PDF_OPTIONS = -sPAPERSIZE=a4
@tlatsas
tlatsas / dpi.py
Last active December 8, 2022 10:27
calculate screen DPI
#!/usr/bin/env python
# calculate screen DPI
# supports both python 2 and 3
import re
import argparse
from math import sqrt
from subprocess import check_output
@tlatsas
tlatsas / arch_kvm_install.md
Last active March 27, 2020 18:26
archlinux kvm guest install cheatsheet
  • partitions
    • use the tool of your choice (fdiks/gdisks/parted)
  • filesystems
    • mkfs -t <fs-type> /dev/<partition>
  • mount partitions on /mnt
  • setup network
    • ip address add <IP>/<CIDR> dev eth0
    • ip route add default via <GW>
    • add dns in /etc/resolve.conf
  • select pacman mirror
@tlatsas
tlatsas / Makefile
Created February 4, 2013 11:45
simple makefile for symfony project
PHP = php
MEM = -d memory_limit=256M
CON = app/console
ENV = dev
all:
@echo ""
@echo "usage:"
@echo ""
@echo "* make assets: update application assets"
@tlatsas
tlatsas / IEEEtran.bst
Created December 4, 2012 16:10
IEEE bib style without URLs
%%
%% IEEEtran.bst
%% BibTeX Bibliography Style file for IEEE Journals and Conferences (unsorted)
%% Version 1.13 (2008/09/30)
%%
%% Copyright (c) 2003-2008 Michael Shell
%%
%% Original starting code base and algorithms obtained from the output of
%% Patrick W. Daly's makebst package as well as from prior versions of
%% IEEE BibTeX styles:
@tlatsas
tlatsas / hdparm-fix.service
Created September 24, 2012 17:00
Systemd service to adjust HDD parking frequency
[Unit]
Description=Fix excessive HDD parking frequency
[Service]
Type=oneshot
ExecStart=/sbin/hdparm -B 220 /dev/sda
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target