Skip to content

Instantly share code, notes, and snippets.

View nathantypanski's full-sized avatar
♥️

Nathan D. Typanski nathantypanski

♥️
View GitHub Profile
#include <MC9S08QE128.h>
#include "MCUinit.h"
void MCU_init(void)
{
SOPT1 = 0x42;
SPMSC1 = 0x1C;
SPMSC2 = 0x02;
SPMSC3 &= (unsigned char)~0x38;
if (*(unsigned char*far)0xFFAF != 0xFF) {
import sys
import os
# maximum file descriptors to close if sysconf(SC_OPEN_MAX)
# is indeterminate
BD_MAX_CLOSE = 8192
def become_daemon(no_umask0=False,
no_chdir=False,
no_close_open_files=False,
# See AUR interface for current maintainer.
#
# See <https://lists.gnu.org/archive/html/emacs-devel/2014-01/msg00005.html>
# for the start of the discussion on why emacs development moves to git.
#
# See <https://lists.gnu.org/archive/html/emacs-devel/2014-01/msg00015.html>
# for the actual community proposal about moving to git with RMS's blessing.
#
# TIP: Don't run this on a tmpfs unless you have oodles of RAM.
#[deriving(Show)]
struct Node {
value: uint,
left: Option<Box<Node>>,
right: Option<Box<Node>>,
}
impl Node {
fn new(val: uint) -> Box<Node> {
@nathantypanski
nathantypanski / dynamic-streaming.rs
Created August 15, 2014 00:24
dynamic page streaming
fn respond_with_dynamic_page(stream: Option<std::io::net::tcp::TcpStream>, path: &Path) {
let mut stream = stream;
let mut file_reader = File::open(path).expect("Invalid file!");
stream.write(HTTP_OK.as_bytes());
let begin_comment : ~[u8] = "<!--#exec cmd=\"".bytes().collect();
let end_comment : ~[u8] = "\" -->".bytes().collect();
SRCDIR = src
PROGRAM_NAME = myprog
all: $(PROGRAM_NAME)
.PHONY: clean $(PROGRAM_NAME)
$(PROGRAM_NAME): $(SRCDIR)/$(PROGRAM_NAME).rs
rustc -L. $(SRCDIR)/$(PROGRAM_NAME).rs
#[feature(macro_rules)];
#![feature(phase)]
#[phase(plugin, link)] extern crate log;
macro_rules! expr (($e: expr) => { $e })
macro_rules! spawn {
($($code: block)*) => {
expr!(spawn(proc() {$($code)*}))
}
@nathantypanski
nathantypanski / truecrypt.diff
Created June 19, 2014 21:50
Truecrypt diff from the goodbye message appearance
diff --recursive -bu truecrypt-7.1a-source/Boot/Windows/BootMain.cpp truecrypt-7.2-source/Boot/Windows/BootMain.cpp
--- truecrypt-7.1a-source/Boot/Windows/BootMain.cpp 2012-02-07 11:36:48.000000000 +0100
+++ truecrypt-7.2-source/Boot/Windows/BootMain.cpp 2014-05-27 18:36:02.000000000 +0200
@@ -75,7 +75,9 @@
#endif // TC_WINDOWS_BOOT_RESCUE_DISK_MODE
- PrintEndl (3);
+ PrintEndl (2);
+ Print ("WARNING: Using TrueCrypt is not secure");
@nathantypanski
nathantypanski / gist:b9d2d453718a22765f5c
Created June 17, 2014 04:56
uses of find_linkage_metas in rust
09967665eaa5ca3d259f0f59ef26c8d236bf47a7:src/libsyntax/attr.rs:pub fn find_linkage_metas(attrs: &[Attribute]) -> Vec<Gc<MetaItem>> {
b9adb6c717627ab6dcc9298b79a8d44cfe2fc616:src/libsyntax/attr.rs:pub fn find_linkage_metas(attrs: &[Attribute]) -> Vec<Gc<MetaItem>> {
375c5b884fd41e637bf0eff6d58c16cc18b179a9:src/libsyntax/attr.rs:pub fn find_linkage_metas(attrs: &[Attribute]) -> Vec<Gc<MetaItem>> {
56d7bbe2637933455249fc3c73f510ab3ef97a29:src/libsyntax/attr.rs:pub fn find_linkage_metas(attrs: &[Attribute]) -> Vec<Gc<MetaItem>> {
6dd6ddd9b9b7bbae9d7e436ddd777729a019c4c6:src/libsyntax/attr.rs:pub fn find_linkage_metas(attrs: &[Attribute]) -> Vec<Gc<MetaItem>> {
f4ae8a83f9e56a7f16a5f0a25d22c74063e2fb5e:src/libsyntax/attr.rs:pub fn find_linkage_metas(attrs: &[Attribute]) -> Vec<Gc<MetaItem>> {
e1971dd35a679ff8fc438f7ccb8d6754de472d6e:src/libsyntax/attr.rs:pub fn find_linkage_metas(attrs: &[Attribute]) -> Vec<Gc<MetaItem>> {
ebac770abb529ebdd1b9de830ee82069d4f754da:src/libsyntax/attr.rs:pub fn find_linkage_metas(attr
@nathantypanski
nathantypanski / changelog.diff
Created June 10, 2014 21:55
udl kernel changes since 2013-06-01
737583f USB: udl: proper error reporting (2 weeks ago) <Oliver Neukum>
diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c
index f5ae574..afdf383 100644
--- a/drivers/gpu/drm/udl/udl_main.c
+++ b/drivers/gpu/drm/udl/udl_main.c
@@ -283,7 +283,7 @@ int udl_submit_urb(struct drm_device *dev, struct urb *urb, size_t len)
int udl_driver_load(struct drm_device *dev, unsigned long flags)
{
struct udl_device *udl;
- int ret;