Skip to content

Instantly share code, notes, and snippets.

@dpq
dpq / Dockerfile
Created June 12, 2019 08:49
How to run Teredici inside Docker (useful for Debian, CentOS and other distros)
FROM ubuntu:16.04
RUN apt-key adv --keyserver pool.sks-keyservers.net --recv-key 67D7ADA8
RUN apt-get update && apt-get install -y wget
RUN apt-get install -y apt-transport-https ca-certificates
RUN wget -O /etc/apt/sources.list.d/pcoip.list https://downloads.teradici.com/ubuntu/pcoip-dev.repo
RUN apt-get update
RUN apt-get install -y pcoip-client libqt5x11extras5 strace
RUN export uid=1000 gid=1000 && \
mkdir -p /etc/sudoers.d/ && \
mkdir -p /home/user && \
@dpq
dpq / mkh4toh5.sh
Last active January 13, 2021 19:30
Debian Stretch H4toH5 utility installation
#!/bin/bash
sudo apt -y install checkinstall libhdf4-dev libhdf5-dev
wget https://support.hdfgroup.org/ftp/HDF5/h4toh5/src/h4h5tools-2.2.3.tar.bz2
tar -xf h4h5tools-2.2.3.tar.bz2
cd h4h5tools-2.2.3
for f in $(rgrep -l 'include "hfile.h"' .); do sed -i 's/"hfile.h"/<hfile.h>/' $f; done
for f in $(rgrep -l 'include "mfhdf.h"' .); do sed -i 's/"mfhdf.h"/<mfhdf.h>/' $f; done
for f in $(rgrep -l 'include "hdf.h"' .); do sed -i 's/"hdf.h"/<hdf.h>/' $f; done
CFLAGS='-lmfhdf -ldf -I/usr/include/hdf' ./configure --with-hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial
make
@dpq
dpq / jpegname.sh
Created December 28, 2014 19:11
Batch rename JPEG files to match the datetime they had been taken on
for x in $(ls -1 *JPG); do mv -i $x IMG_$(exif $x | grep Date | head -1 | awk '{ print $4"_"$5 }' | sed 's/[|:]//g').jpg; done
@dpq
dpq / decode.py
Created August 28, 2013 10:36
Fourier transformation of binaries
#!/usr/bin/python
from scipy.fftpack import rfft, irfft
from scipy import array
import struct
from sys import argv
if len(argv) < 2:
print "Usage: ./encode.py SOURCEFILE"
exit()
@dpq
dpq / world.sh
Created August 27, 2013 18:40
Rebuild all installed Debian packages from source.
mkdir world; cd world
for PKG in `aptitude search ~i | awk '{ print $3; }'`; do
apt-get source $PKG
PKGDIR=`find . -maxdepth 1 -mindepth 1 -type d`
cd $PKGDIR
MISSINGDEPS=`cat debian/control | grep Build-Depends | sed 's/,//g' | sed 's/([^)]*)//g' | sed 's/\[[^][]*\]//g' | sed 's/Build-Depends\://'`
aptitude -y install $MISSINGDEPS
dpkg-buildpackage
cd ..
dpkg -i *.deb
@dpq
dpq / README
Created August 27, 2013 18:38
Send an sms, parse its parameters, create a document from a template and fax it away! Uses comtube.com
This small program was written for a friend who had to fax papers granting access to a factory's
territory to automobiles and persons mentioned in his SMS messages of a specific format.
Don't ask why :)
The format of SMS for a car:
@<COMTUBE_ACCOUNT> car DD.MM.YY, марка, номер [, driver name, arrival HH:MM, departure HH:MM]
The format of SMS for a group of people:
@<COMTUBE_ACCOUNT> fio DD.MM.YY, Name 1 [, Name 2 .. Name 8]
@dpq
dpq / contacts-backup.py
Created August 27, 2013 18:27
Backup SIM card contacts to a CSV file
#!/usr/bin/python
import io
dev = "/dev/ttyUSB1" # Replace this if necessary
cmd,data = io.open(dev, "w"), io.open(dev, "r")
cmd.write(u"AT+CPBR=?\n")
min_id, max_id = -1, -1