Skip to content

Instantly share code, notes, and snippets.

@dpapathanasiou
dpapathanasiou / HOWTO.md
Created November 4, 2018 15:53
How to connect to a USB Armory via ssh on linux

Based on the Host communication instructions, but with a tweak for when the usb0 address is not found:

$ /sbin/ip link set usb0 up
Cannot find device "usb0"

Because of the predictable network interface name scheme, though, usb0 may be renamed to something else:

@dpapathanasiou
dpapathanasiou / trie.py
Last active April 16, 2022 09:47
Ternary Search Tree in python
#!/usr/bin/env python
"""
A ternary search tree implementation, inspired by:
http://www.drdobbs.com/database/ternary-search-trees/184410528 and
https://lukaszwrobel.pl/blog/ternary-search-tree/
https://github.com/djtrack16/tst/blob/master/ternarysearchtree.py
"""
@dpapathanasiou
dpapathanasiou / binary_search_tree.py
Last active March 31, 2019 21:40
Binary Search Tree in Python
#!/usr/bin/env python
"""
A binary search tree implementation, from:
"Python Algorithms: Mastering Basic Algorithms in the Python Language"
by Magnus Lie Hetland
ISBN: 9781484200551
@dpapathanasiou
dpapathanasiou / reflexes.c
Last active December 26, 2015 14:27
Concurrency programming example: test user reflexes
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <pthread.h>
void *listen(void *timestamp) {
int c;
while((c = getc(stdin)) != EOF) {
if( c == '\n' ) {
@dpapathanasiou
dpapathanasiou / reflexes.go
Created December 26, 2015 14:20
Concurrency programming example: test user reflexes
package main
import (
"bufio"
"fmt"
"math/rand"
"os"
"time"
)
@dpapathanasiou
dpapathanasiou / MatrixDSL.scala
Created July 26, 2015 23:54
DSL processing in Scala
/* This is a scala solution for a mini domain specific language (DSL)
* defining instructions for populating an empty matrix.
*
* Input consists of a single string separated by spaces:
* - the first number represents the size of the matrix, NxN
* - the rest of the input consists of one or more strings defining
* the range of cells and how each of their populations will be
* incremented
*
* Increment pattern possibilities:
@dpapathanasiou
dpapathanasiou / SchemaSpy-HOWTO.md
Last active February 17, 2024 19:45
How to use SchemaSpy to generate the db schema diagram for a PostgreSQL database

SchemaSpy is a neat tool to produce visual diagrams for most relational databases.

Here's how to use it to generate schema relationship diagrams for PostgreSQL databases:

  1. Download the jar file from here (the current version is v6.1.0)

  2. Get the PostgreSQL JDBC driver (unless your installed version of java is really old, use the latest JDBC4 jar file)

  3. Run the command against an existing database. For most databases, the schema (-s option) we are interested in is the public one:

@dpapathanasiou
dpapathanasiou / debian-install.sh
Created January 18, 2015 19:00
All the packages I install on a new debian system
apt-get install -y build-essential \
# development \
git mercurial roxterm curl gawk \
libpcre3-dev libssl-dev \
qt4-dev-tools libqt4-dev libqt4-core libqt4-gui libqt4-opengl libqt4-network \
libssl-dev libdb5.1++-dev libboost-all-dev libqrencode-dev libminiupnpc-dev \
python-all-dev python-lxml python-magic python-imaging python-pip python-pandas \
erlang \
# word processing \
texlive-latex-base latex2rtf texlive-full \
@dpapathanasiou
dpapathanasiou / RaspberryPi_A_Plus_Wifi.md
Created January 10, 2015 19:49
How to setup a usb wifi dongle on the Raspberry Pi Model A+

Rationale

The Raspberry Pi Model A+ has just a single usb port, so getting the wifi configured has to done by editing /etc/network/interfaces from a command line prompt.

These instructions assume the Raspbian OS on the SD card, and a usb wifi adapter that supports the RTL8192cu chipset, since the current Raspbian has built-in support for it.

Before the first boot

  1. Put a keyboard in the usb slot
  2. Connect the HDMI slot to a monitor
@dpapathanasiou
dpapathanasiou / ComodoSSL_HOWTO.md
Last active March 11, 2023 12:15
Installing Comodo SSL Certificates

Create the Certificate Signing Request (CSR) file

openssl req -nodes -newkey rsa:4096 -keyout example_com.key -out example_com.csr

Prepare the Bundle file

Unzip the file Comodo sends back and create a single certificate bundle file.