Skip to content

Instantly share code, notes, and snippets.

View dpk's full-sized avatar

Daphne Preston-Kendal dpk

  • Berlin, Germany
View GitHub Profile
#!/usr/bin/env ruby
require 'zlib'
require 'rexml/document'
File.open("CONTENT.tda") do |zipped_f|
File.open("CONTENT.tda.tdz", "r") do |index_f|
while record = index_f.read(8)
size = record.unpack("V*")[1]
@sbp
sbp / degree-precisions.txt
Created August 15, 2011 12:54
Degree, minute, and second precisions
degrees
1 - 111.132km
0.1 - 11.1132km
0.01 - 1.11132km
0.001 - 111.132m
0.0001 - 11.1132m
0.00001 - 1.11132m
0.000001 - 11.1132cm
0.0000001 - 1.11132cm
@jblyberg
jblyberg / suid-wrapper.c
Created October 16, 2012 14:29
A very small C wrapper for running shell scripts suid. Pretty dangerous, but handy.
#include <unistd.h>
#include <errno.h>
main( int argc, char ** argv, char ** envp )
{
if( setgid(getegid()) ) perror( "setgid" );
if( setuid(geteuid()) ) perror( "setuid" );
envp = 0; /* blocks IFS attack on non-bash shells */
system( "/path/to/bash/script", argv, envp );
perror( argv[0] );
@mpasternacki
mpasternacki / freebsd_on_mbp.md
Created January 23, 2015 17:12
FreeBSD on a MacBook Pro

FreeBSD on a MacBook Pro

Since 2008 or 2009 I work on Apple hardware and OS: back then I grew tired of Linux desktop (which is going to be MASSIVE NEXT YEAR, at least since 2001), and switched to something that Just Works. Six years later, it less and less Just Works, started turning into spyware and nagware, and doesn't need much less maintenance than Linux desktop — at least for my work, which is system administration and software development, probably it is better for the mythical End User person. Work needed to get software I need running is not less obscure than work I'd need to do on Linux or othe Unix-like system. I am finding myself turning away from GUI programs that I used to appreciate, and most of the time I use OSX to just run a terminal, Firefox, and Emacs. GUI that used to be nice and unintrusive, got annoying. Either I came full circle in the last 15 years of my computer usage, or the OSX experience degraded in last 5 years. Again, this is from a sysadmin/developer ki

#lang racket

Detecting Tail Position With Respect To A Prompt Tag

Uses continuation marks to inspect the "size" of the delimited continuation.

(require racket/control)

Here is the prompt tag we will be using throughout the example. A library would probably abstract over the particular tag concerned.

@upperstream
upperstream / httpserver.sh
Last active May 2, 2024 23:40
Simple HTTP Server (shell script)
#!/bin/sh
#
# Copyright (C) 2017 Upper Stream.
#
# See the bottom of this file for licensing conditions.
#
#set -x
set -e
@0xabad1dea
0xabad1dea / copilot-risk-assessment.md
Last active September 11, 2023 10:21
Risk Assessment of GitHub Copilot

Risk Assessment of GitHub Copilot

0xabad1dea, July 2021

this is a rough draft and may be updated with more examples

GitHub was kind enough to grant me swift access to the Copilot test phase despite me @'ing them several hundred times about ICE. I would like to examine it not in terms of productivity, but security. How risky is it to allow an AI to write some or all of your code?

Ultimately, a human being must take responsibility for every line of code that is committed. AI should not be used for "responsibility washing." However, Copilot is a tool, and workers need their tools to be reliable. A carpenter doesn't have to

#
# Name: XCCS (XC-3-1-1-0) to Unicode
# Unicode version: 12.0
# Table version: 0.1
# Table format: Format A
# Date: 6-Aug-2020
# Author: Ron Kaplan <[email protected]>
# John Cowan <[email protected]>
#
# This file contains mappings from the Xerox Character Code Standard (version