Skip to content

Instantly share code, notes, and snippets.

View csarn's full-sized avatar

Chris S csarn

View GitHub Profile
#!/bin/sh
# Check if the individual developer has his own hook
CMD_NAME=`basename $0`
if [ -f $GIT_DIR/hooks/personal/$CMD_NAME ]
then
# If so, run it. $@ passes all the command line arguments passed to this function
# If the personal hook fails, fail this one as well
if ! $GIT_DIR/hooks/personal/$CMD_NAME $@
then
@tomislacker
tomislacker / buildStatic.sh
Created February 14, 2014 18:09
Building a statically linked suite of git/git binaries for deployment on 32bit hosts
#!/bin/bash
cd $(dirname $0)
LOG_PREFIX=build-static
LOG_STDOUT=${LOG_PREFIX}.stdout
LOG_STDERR=${LOG_PREFIX}.stderr
REMOVE_TARGET_DIR=n
SOURCE_MAKE_CONF=y
@tomerfiliba
tomerfiliba / construct++.cpp
Created February 25, 2014 19:54
Consturct++: Pickler combinators in C++11
#include <iostream>
#include <sstream>
#include <cstdint>
#include <cstddef>
#include <string>
#include <memory>
#include <vector>
#include <tuple>
#include <utility>
#include <type_traits>
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@ataffanel
ataffanel / map.html
Created April 20, 2015 14:12
Simple OSM map view in pyqt using QtWebkit
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<style>
body { padding: 0; margin: 0; }
html, body, #map { height: 100%; }
</style>
</head>
@filviu
filviu / 30detectproxy
Created December 2, 2015 10:26
apt-get use a proxy only if available. Shamelessly lifted from here: http://askubuntu.com/questions/53443/how-do-i-ignore-a-proxy-if-not-available
# /etc/apt/apt.conf.d/30detectproxy:
# Fail immediately if a file could not be retrieved. Comment if you have a bad
# Internet connection
Acquire::Retries 0;
# undocumented feature which was found in the source. It should be an absolute
# path to the program, no arguments are allowed. stdout contains the proxy
# server, stderr is shown (in stderr) but ignored by APT
Acquire::http::ProxyAutoDetect "/etc/apt/detect-http-proxy";
#!/usr/bin/env bash
mountSnapshots () {
mkdir -p "/mnt/$ZFSSNAPSHOTNAME"
mount -t zfs "$ZFSSNAPSHOTBASE@$ZFSSNAPSHOTNAME" "/mnt/$ZFSSNAPSHOTNAME"
while read -r line
do
MOUNTPATH=$(echo "$line" | sed "s/$ESCAPEDZFSSNAPSHOTBASE\///" | sed "s/@$ZFSSNAPSHOTNAME//")
@edmundsmith
edmundsmith / writeup.md
Created July 7, 2019 20:47
Method for Emulating Higher-Kinded Types in Rust

Method for Emulating Higher-Kinded Types in Rust

Intro

I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.

There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.

As an example, currently we can express this type:

@burjui
burjui / main.rs
Last active May 28, 2021 01:27
Vec and Option monads
/// https://gist.github.com/edmundsmith/855fcf0cb35dd467c29a9350481f0ecf
struct Forall;
trait Unplug {
type F;
type A;
}
trait Plug<A> {
@CRTified
CRTified / README.md
Last active May 5, 2024 15:57
VFIO Passthrough on NixOS

VFIO Setup on NixOS

Disclaimer: Nobody else tested my setup so far, so this is a "works on my machine" scenario. I am not responsible for anything you break on your machine (although I'd not expect much harm).

Hardware

My system has the following hardware:

  • Board: ASRock X570 Pro4