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 / peimportlist.cpp
Created August 26, 2015 04:01
Display a list of imports in a PE file
// Copyright (c) 2011 Nathan Osman
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
@nathan-osman
nathan-osman / dnsupdate.go
Created September 9, 2015 20:48
Update a DNS record via an HTTP GET request
// Compile for the current platform with:
// go build dnsupdate.go
// Cross-compile for Windows with:
// GOOS=windows GOARCH=amd64 go build dnsupdate.go
package main
import (
"fmt"
"net/http"
@nathan-osman
nathan-osman / twitter.txt
Last active August 22, 2018 03:30
Check Twitter for available usernames
test1
test2
...
@nathan-osman
nathan-osman / timeout.js
Created October 19, 2015 21:28
Simple class for managing timeouts in JavaScript
/**
* Simplify the process of setting and resetting timeouts.
* @param fn callback to invoke
* @param delay time in MS
*
* Any additional parameters are passed to the callback when invoked.
*/
function Timeout(fn, delay) {
var timeout = null,
args = $.map(arguments, function(v, i) {
@nathan-osman
nathan-osman / exepath.go
Last active October 26, 2015 17:46
Retrieve path to executable in Go on Windows
// +build windows
package main
import (
"fmt"
"syscall"
"unicode/utf16"
"unsafe"
)
@nathan-osman
nathan-osman / version_compare.py
Created November 5, 2015 06:21
Sort a list of version numbers
#!/usr/bin/env python2
from argparse import ArgumentParser
from apt_pkg import init_system, version_compare
if __name__ == '__main__':
parser = ArgumentParser(description="Sort a list of version numbers")
parser.add_argument(
@nathan-osman
nathan-osman / CMakeLists.txt
Created January 27, 2016 05:04
Add to %PATH% before starting another process
cmake_minimum_required(VERSION 2.8.9)
project(printpath)
add_executable(printpath path.cpp)
set(ENV{PATH} "C:/Some/Path;$ENV{PATH}")
add_custom_target(show "$<TARGET_FILE:printpath>")
add_dependencies(show printpath)
@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})
@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 / 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')