Skip to content

Instantly share code, notes, and snippets.

View stpettersens's full-sized avatar

Sam Saint-Pettersen stpettersens

View GitHub Profile
@stpettersens
stpettersens / Dockerfile
Last active July 20, 2017 14:06
Dockerfile for a Node.js-based application; based on @phusion 's base-image.
#
# Dockerfile for a Node.js-based application; derived from @phusion's container
# (Docker optimized Ubuntu 16.04 LTS system phusion/base-image:latest container
# - https://github.com/phusion/baseimage-docker/blob/master/image/Dockerfile).
#
# saintpettersens/docker-nodejs
#
FROM phusion/baseimage:latest
@stpettersens
stpettersens / talkingclock.rs
Last active July 23, 2017 12:24
A /r/dailyprogrammer challenge.
/*
Talking clock
Command line application which says the time.
Copyright 2017 Sam Saint-Pettersen.
Released under the MIT License.
*/
extern crate clioptions;
extern crate litepattern;
@stpettersens
stpettersens / paintcalc.rs
Last active June 23, 2017 21:40
Utility to calculate the volume of paint needed to paint a room of supplied dimensions [in Rust].
/*
Utility to calculate the volume of paint needed to
paint a room of supplied dimensions.
Sam Saint-Pettersen, 2017.
*/
extern crate clioptions;
use clioptions::CliOptions;
use std::io::stdin;
use std::process::exit;
@stpettersens
stpettersens / rustup-init.sh
Created June 8, 2017 19:46
Script to install Rust on CI; copied from Travis CI's support for Rust.
#!/bin/sh
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
@stpettersens
stpettersens / netsh.cc
Created May 16, 2017 10:31
Spoof netsh command in C++.
/*
Spoof netsh command.
Public domain.
- Sam Saint-Pettersen.
*/
#include <iostream>
int main() {
std::cout << "Name : DUMMY_WIFI" << std::endl;
@stpettersens
stpettersens / netsh.cmd
Last active May 11, 2017 18:35
Spoof netsh command.
@rem spoof netsh command to test SSID library on Appveyor.yml
echo Name : DUMMY_WIFI
echo State : connected
echo SSID : DUMMY_ID
echo Profile : DUMMY_ID
@stpettersens
stpettersens / alias.rs
Created February 28, 2017 13:58
Alias a structure/implementation and use it.
pub struct Dummy {
foo: String,
bar: String,
}
impl Dummy {
pub fn new(foo: &str, bar: &str) -> Dummy {
Dummy {
foo: foo.to_owned(),
bar: bar.to_owned(),
@stpettersens
stpettersens / compiler.txt
Last active December 7, 2016 12:17
Crystal compilation on Windows using Linux local server.
sh crystal-compiler.sh
@stpettersens
stpettersens / crystal.png
Last active November 12, 2016 21:27
Additional icons (Crystal, TOML, Lockfiles, etc.) for VSCode Great Icons pack.
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AsIEBo3fEJUeAAAAo9JREFUSMftlV1I01EYxn/nv+Pcn4FMN1dmpFhIEN7URUHlZ2L0cdNV3xAV9EVdSaS4jbmywCsjTIwChYikzJBIhmFBBF2IdRFhIIqZNEIyULf/Pk4XDZoxdRO964Vzdd7zPO95eN/nFUopVjM0VjlWnUDi80EwSGB4mKlYDJMR5av/6kOgMEkxQSC0ANaX9dW3LkXNJnI0DWdxMVgsyHkpQhDwN+wEowb4CZgTbkPAOkBfgGBbwN/Qbj/Q9CGpRJqmMdVbv8PA6ANagRPAGeBs/OwHniyiht3A6J/qrd+saVoCga6DbmG0x1USIvgKaAO6gGzAFC9CAyQQW0Jy+4ya8Y/2uArQLaDriDH9R5aBkT+pJvoNwi80RAtQkOTxGFALHF+MIaKiWETmSJ7IrzZjDsiPsaFG4EgmlgkpTHXAdkAAyxoQi8gkqEJFn9WnbqBLWoX1AfA+oqKtwFFgIP4DlX5LSiJEALAKqwsYlrvGNw0BQ79KrdqbkYEOm8i+CLwDNqSg+Xx5iDCtptldVLo36/VMHwK0DIeDDIcDe/tgp1OsOR9W4TvAVmA83UEMqzB2YT9kbx/sy8j9g/sXYHaW4oM37upCrwXuAVuAiXgnpRQC7WTJHk83c3NJrEIpYpEozhpfs0S6gQ5gI/AtFRIz5nOFZd7OaCQKCQY6XwIFSsXIq2z0Ak0S+QjIByYXI5HIKzn7fG0qVbNTKNZWNtUBt4GnQC7wPRmJRF6zVXlaVEyl66aKnArvZeA+8BywAYF/krw5VZ6by7JrFT+O8uunJfIx8AxwJFTe7CzzuldkH2RXug9L5FvgWBy81VbhqV3RhWMrd58CXkpkr63CdSHVQZdpukFHuvYh/i/9peI3Fs