This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Copyright 2011 Michael Komitee. All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without modification, are | |
# permitted provided that the following conditions are met: | |
# | |
# 1. Redistributions of source code must retain the above copyright notice, this list of | |
# conditions and the following disclaimer. | |
# | |
# 2. Redistributions in binary form must reproduce the above copyright notice, this list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <krb5.h> | |
/* | |
In krb5.h ... | |
krb5_error_code is defined as: | |
typedef int krb5_int32 | |
typedef krb5_int32 krb5_error_code; | |
krb5_context is defined as: | |
struct _krb5_context; | |
typedef struct _krb5_context * krb5_context; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate libc; | |
use libc::*; | |
use std::ptr; | |
#[allow(non_camel_case_types)] | |
#[repr(C)] | |
type krb5_error_code = c_uint; | |
#[allow(non_camel_case_types)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate libc; | |
#[allow(non_camel_case_types)] | |
#[repr(C)] | |
type krb5_error_code = libc::c_int; | |
#[allow(non_camel_case_types)] | |
#[repr(C)] | |
struct krb5_context; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// My objective is to return an environment variable parsed as an integer, | |
// and if either the environment variable isn't set, or it can't be parsed as | |
// an integer, return a default value. | |
// This works, but is kind of ugly ... | |
fn u32_from_env_with_default(env: &str, default: u32) -> u32 { | |
let tmp_1 = std::env::var(env); | |
if tmp_1.is_ok() { | |
let tmp_2 = tmp_1.unwrap().parse::<u32>(); | |
if tmp_2.is_ok() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .../all-services-ready.target | |
[Unit] | |
Description=All Services Ready | |
AllowIsolate=yes | |
Wants=multi-user.target | |
After=multi-user.target | |
# .../manage-services.service | |
[Unit] | |
Description=Manage Services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let mut exit_code = 0; | |
{ | |
// real work which may mutate exit_code | |
exit_code = 1; | |
} | |
process::exit(exit_code); | |
} |