Skip to content

Instantly share code, notes, and snippets.

View nathan-osman's full-sized avatar

Nathan Osman nathan-osman

View GitHub Profile
@nathan-osman
nathan-osman / letsencrypt.go
Created April 20, 2017 02:22
Obtain a Let's Encrypt certificate from the ACME staging server using golang.org/x/crypto/acme
package main
import (
"context"
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
@nathan-osman
nathan-osman / measurer.ino
Created April 19, 2017 23:14
Measure distance and display on OLED screen
/**
* Measure distance and display on OLED screen
* Copyright 2017 - Nathan Osman
*/
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Fonts/FreeSans12pt7b.h>
@nathan-osman
nathan-osman / domains.go
Last active February 2, 2017 09:14
Test a list of domains
package main
import (
"bufio"
"log"
"net/http"
"net/url"
"os"
"sync"
"time"
@nathan-osman
nathan-osman / win32.go
Last active August 31, 2023 22:01
Simple Windows GUI application written in Go
package main
import (
"log"
"syscall"
"unsafe"
)
var (
kernel32 = syscall.NewLazyDLL("kernel32.dll")

Using TLS in NitroShare

Current builds of NitroShare now include support for TLS. This feature is still in active development but enough has been completed that it is ready for testing.

To use this feature, you must first generate a key and root CA certificate:

openssl genrsa -out root.key 2048
openssl req -x509 -new -nodes -key root.key -sha256 -days 3650 -out root.crt

You will be asked a few questions about the CA and it is important you do not leave any fields blank since this causes problems verifying the certificates later. Next, you will need to generate a key, CRL, and signed certificate for each device:

NitroShare for Nautilus

The latest commits to NitroShare have added a local HTTP API that applications can take advantage of. To help demonstrate how this works, I have written a Nautilus extension that adds an item to the right-click menu for sending items with NitroShare

To try out the extension, please follow these instructions:

  • install the gir1.2-nautilus-3.0, gir1.2-gtk-3.0, and python-requests packages
  • download the nitroshare.py file included in this gist and save it to ~/.local/share/nautilus-python/extensions
  • restart nautilus (Alt+F2 and killall nautilus)
@nathan-osman
nathan-osman / README.md
Last active April 26, 2016 00:38
List of Ubuntu archive mirrors

How to Use

The country.txt file contains a list of all country mirrors as of 2016-04-25. The path for all country mirrors is /ubuntu/.

@nathan-osman
nathan-osman / PKGBUILD
Created April 23, 2016 20:15
QHttpEngine on Arch
# Maintainer: Nathan Osman <nathan@quickmediasolutions.com>
pkgname='qhttpengine'
pkgver='0.1.0'
pkgrel=1
pkgdesc="Simple and secure HTTP server for Qt applications"
arch=('i686' 'x86_64')
license=('MIT')
url="http://github.com/nitroshare/qhttpengine"
depends=('qt5-base')
@nathan-osman
nathan-osman / CMakeLists.txt
Last active April 8, 2016 05:56
Send an email to Hectane with Qt
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
project(emailer)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Network 5.4 REQUIRED)
add_executable(emailer emailer.cpp)
set_property(TARGET emailer PROPERTY CXX_STANDARD 11)
@nathan-osman
nathan-osman / CMakeLists.txt
Created March 28, 2016 19:43
Lookup an icon by name and size
cmake_minimum_required(VERSION 2.8.9)
project(gtktest LANGUAGES C)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
include_directories(${GTK3_INCLUDE_DIRS})
add_executable(gtktest main.c)
target_link_libraries(gtktest ${GTK3_LIBRARIES})