Skip to content

Instantly share code, notes, and snippets.

@manuels
manuels / gist:8c264818252cabe3081c
Created April 22, 2015 09:26
not-crashing-anymore.rs
extern crate libc;
use libc::{c_short, c_int, c_void, ssize_t, size_t};
use std::thread;
mod linux {
use std::os::unix::io::RawFd;
use libc::c_int;
pub fn socketpair(domain: i32, type_: i32, protocol: i32) -> Result<(RawFd, RawFd), i32> {
int apply(int (*func)(int), int x) {
return func(x);
}
int apply(int (*func)(int), int x) {
return func(x);
}
@manuels
manuels / crashing_code.rs
Created October 19, 2014 12:21
Rust Compiler Error for callbacks
extern crate libc;
extern crate native;
use libc::{c_short, c_int};
mod linux {
use native::io::file::FileDesc;
use libc::c_int;
pub fn socketpair(domain: int, type_: int, protocol: int) -> Result<(FileDesc, FileDesc), int> {
extern crate sync;
extern crate collections;
use std::comm::Chan;
use std::mem::size_of_val;
use std::io::{ChanWriter,PortReader};
use collections::hashmap::HashMap;
use std::task::try;
use sync::RWArc;
@manuels
manuels / dtls-client.py
Last active September 11, 2020 08:55
dtls for python
# -*- coding: latin-1 -*-
#
# Copyright (C) AB Strakt
# Copyright (C) Jean-Paul Calderone
# See LICENSE for details.
"""
Simple SSL client, using blocking I/O
"""
<html>
<style>
/*! normalize.css v1.0.0 | MIT License | git.io/normalize */
article,aside,details,figcaption,figure,footer,header,hgroup,nav,section,summary{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}html,button,input,select,textarea{font-family:sans-serif}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}h2{font-size:1.5em;margin:.83em 0}h3{font-size:1.17em;margin:1em 0}h4{font-size:1em;margin:1.33em 0}h5{font-size:.83em;margin:1.67em 0}h6{font-size:.75em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}blockquote{margin:1em 40px}dfn{font-style:italic}mark{background:#ff0;color:#000}p,pre{margin:1em 0}code,kbd,pre,samp{font-family:monospace,serif;_font-family:'courier new',monospace;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-
@manuels
manuels / gist:1712984
Created January 31, 2012 21:21
Running Hem with Haml and Eco
var hem = new (require('hem'));
var haml = require('haml');
var eco = require('eco');
var fs = require('fs');
var argv = process.argv.slice(2);
hem.compilers.haml = function(path) {
var content = fs.readFileSync(path, 'utf8')
var template;
template = haml(content)()
Dear Diasporians,
We are sorry that you are currently encountering a lot of errors on JoinDiaspora.com which are caused by overstrain of our hardware resources.
Due to a tragic loss in our developer community we have limited options to solve this issue and ask for your patience concerning the availability of our service.
We appreciate your understanding and thank all of you for your condolences!
The Diaspora Podrunners and Developers
require 'erb'
module Diaspora
module Markdownify
class HTML < Redcarpet::Render::HTML
include ActionView::Helpers::TextHelper
include ActionView::Helpers::TagHelper
def initialize(options={})
@options = options