Skip to content

Instantly share code, notes, and snippets.

Installing libcurl with Updated OpenSSL Support

If your Linux distribution is so out of date that you can no longer install updated patches, you'll typically need to either reach for an unsupported package or install the software via source. Additionally, I didn't want to interfere with installed software in fear of rendering the system unusable.

Become Root and Grab Tarballs

You're going to be installing stuff that requires root access, so it's easier to just be able to do it when you want without having to worry about using sudo and permissions. Be careful you don't delete anything you can't recover

$ sudo su - 
@reagent
reagent / encode-test
Created September 26, 2012 15:31
Test harness for David's encode.c program
#!/usr/bin/env ruby
# Usage: ./encode-test /path/to/encode.c
require 'fileutils'
def directory(path)
path = File.expand_path(path)
if File.directory?(path)
path
@reagent
reagent / migrator.rb
Created November 21, 2017 17:31
DIY migrations in Ruby
require 'pg'
require 'uri'
class Migrator
class Migration
def initialize(connection, path)
@connection, @path = connection, path
end
#!/usr/bin/env ruby
url = ARGV.pop
if url.to_s.strip.length == 0
puts "Error: Please supply a URL"
exit 1
end
uncompressed_bytes = `curl "#{url}" --silent --write-out "%{size_download}\n" --output /dev/null`
@reagent
reagent / xmas.ino
Created December 2, 2013 08:36
ruff & reddy
class Note {
short frequency;
int tempo;
public:
String name;
Note(String name) {
this->name = name;
this->tempo = 150;
<%=
begin
render "pages/#{foo}/data"
rescue ActionView::MissingTemplate
render "pages/data"
end
%>
@reagent
reagent / pad.c
Last active December 15, 2015 18:59
dat pad
char *
pad(char *in, size_t width)
{
char *padded = NULL,
*fmt = NULL;
check(asprintf(&fmt, "%%%lds", width) >= 0);
check(asprintf(&padded, fmt, in) >= 0);
free(in);
@reagent
reagent / .gitignore
Created April 1, 2013 14:50
String Calculator
calc
*.o
*.dSYM
@reagent
reagent / malloc_size.c
Created March 25, 2013 19:49
Checking size of allocation
#include <stdlib.h>
#include <stdio.h>
#include <malloc/malloc.h>
int
main()
{
char *thing = malloc(1 * sizeof(char));
printf("Alloc'd: %ld bytes\n", malloc_size(thing));
@reagent
reagent / .gitignore
Last active December 15, 2015 07:18
Dynamic array + union
main
*.o
*.dSYM