Skip to content

Instantly share code, notes, and snippets.

@stuaxo
stuaxo / processify.py
Last active July 12, 2024 08:32 — forked from schlamar/processify.py
processify
# modified from https://gist.github.com/schlamar/2311116#file-processify-py-L17
# also see http://stackoverflow.com/questions/2046603/is-it-possible-to-run-function-in-a-subprocess-without-threading-or-writing-a-se
import inspect
import os
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue
@paragonie-scott
paragonie-scott / crypto-wrong-answers.md
Last active November 21, 2025 14:34
An Open Letter to Developers Everywhere (About Cryptography)
@soderstroff
soderstroff / rust.hs
Last active September 17, 2022 09:50
-- This is a comment. It is not code. There are no multi-line comments.
-- You did not want those, anyway.
-- Functions take arguments separated by whitespace.
f x y z
-- The only exception is functions of no arguments.
no_args_fun ~ -- This is sort of like passing void to a function.
-- Function declarations separate arguments by comma.
f :: i32, i32 -> i32

Things that programmers don't know but should

(A book that I might eventually write!)

Gary Bernhardt

I imagine each of these chapters being about 2,000 words, making the whole book about the size of a small novel. For comparison, articles in large papers like the New York Times average about 1,200 words. Each topic gets whatever level of detail I can fit into that space. For simple topics, that's a lot of space: I can probably walk through a very basic, but working, implementation of the IP protocol.

@stevenp
stevenp / gist:a6740694b4e23baccfab
Last active September 10, 2015 23:26
Disable App Transport Security in iOS 9
Add this to the Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
#![feature(core)]
use std::sync::Mutex;
use std::thread;
use std::mem;
use std::rc::Rc;
use std::cell::RefCell;
use std::marker::PhantomData;
use std::boxed::FnBox;
pub struct Scope<'a> {
@14427
14427 / hkt.rs
Last active September 26, 2025 13:52
Higher-kinded type trait
use std::rc::Rc;
trait HKT<U> {
type C; // Current type
type T; // Type with C swapped with U
}
macro_rules! derive_hkt {
($t:ident) => {
impl<T, U> HKT<U> for $t<T> {
@ruby0x1
ruby0x1 / main.cpp
Last active January 4, 2019 21:09
SDL2 sample
//SDL2 flashing random color example
//Should work on iOS/Android/Mac/Windows/Linux
#include <SDL.h>
#include <SDL_opengl.h>
#include <stdlib.h> //rand()
static bool quitting = false;
static float r = 0.0f;
@GeorgeHahn
GeorgeHahn / gist:914f2ebafff1ccd485b4
Last active September 12, 2018 19:34
Considering Rust + CLR interop

#Brainstorming Rust + C# interop

Use case A

  • Rust UI via WPF or Persperex
  • Make it feel like XAML is Rust-native
  • Put function name in WPF event handler, we stub out from that to Rust code
  • Rust event handlers written with a macro that we use to write interop stubs on each side
  • Can I do GUI nesting without XAML? Eg like the Zinc.rs config block, but for UI elements
  • Pros:
@domenic
domenic / 0-github-actions.md
Last active June 6, 2025 08:01
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.