Skip to content

Instantly share code, notes, and snippets.

@pacozaa
pacozaa / tleparser.py
Created October 28, 2016 16:17
Parses a NORAD two line element set into a Python dictionary.
def parse_tle_number(tle_number_string):
split_string = tle_number_string.split('-')
if len(split_string) == 3:
new_number = '-' + str(split_string[1]) + 'e-' + str(int(split_string[2])+1)
elif len(split_string) == 2:
new_number = str(split_string[0]) + 'e-' + str(int(split_string[1])+1)
elif len(split_string) == 1:
new_number = '0.' + str(split_string[0])
else:
raise TypeError('Input is not in the TLE float format')
@pacozaa
pacozaa / letsencrypt.md
Created October 24, 2016 10:42 — forked from xrstf/letsencrypt.md
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@pacozaa
pacozaa / PosPrinter.java
Created June 5, 2016 13:38 — forked from dulichan/PosPrinter.java
COM port printer writing java example
package app.posmachine.machine;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Enumeration;
import javax.comm.CommPortIdentifier;
import javax.comm.SerialPort;
public class PosPrinter {
@pacozaa
pacozaa / gist:e625ac9b1f4447c8e7df
Created February 21, 2016 09:10 — forked from fajrif/gist:1265203
git clone specific tag
git clone <repo-address>
git tag -l
git checkout <tag-name>
git branch -D master
git checkout -b master
@pacozaa
pacozaa / gist:78b602244990cd261523
Created January 31, 2016 11:36 — forked from jonleighton/base64ArrayBuffer.js
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
function base64ArrayBuffer(arrayBuffer) {
var base64 = ''
var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
var bytes = new Uint8Array(arrayBuffer)
var byteLength = bytes.byteLength
@pacozaa
pacozaa / nodejs-tcp-example.js
Created November 19, 2015 04:49 — forked from tedmiston/nodejs-tcp-example.js
Node.js tcp client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');