Skip to content

Instantly share code, notes, and snippets.

@codingfoo
codingfoo / constrain.py
Created January 8, 2021 05:17
Generate Reading list from a csv list of recomendations.
import csv
HARD_MODE = 2
NORMAL_MODE = 3
recs_column = HARD_MODE
name_column = 0
from constraint import *
problem = Problem()

Learn a variety of programming paradigms:

  • Write a program in assembly language
  • Write an application in a functional language
  • Write an application in an object-oriented language
  • Write an application in a prototype-based language
  • Write an application in a logic programming language
  • Write an application using the Actor model
  • Write an application in Forth
@codingfoo
codingfoo / README
Last active July 19, 2017 20:03
Proof of concept for Elixir add functions to a mock library in tests
1. To pull in functions from multiple Tests a different before_compile hook needs to be registered for each test module
2. To add mocks to multiple mock modules, a attribute needs to be set up for each mock
@codingfoo
codingfoo / rocket_launcher.rb
Last active December 29, 2016 01:07
Foam Missile Launcher Control in Ruby
#!/usr/bin/env ruby
Version = '0.1'
abort("Usage: #{__FILE__} idVendor:idProduct") if ARGV.empty?
require 'curses'
require 'libusb'
# Add your own idVendor, idProduct, and movement codes here!
@codingfoo
codingfoo / index.js
Created February 16, 2016 17:58
Template for nodjs http server
var http = require('http'); // require is unique to nodejs
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
// Listen on port 8080, IP defaults to 127.0.0.1
server.listen(8080);
@codingfoo
codingfoo / Readme.md
Last active February 12, 2016 03:44
Sensu Widget for Dashing

Description

Simple Dashing job to send sensu client history checks to dashing widgets.

##Dependencies

##Usage

Put the sensu.rb file in your /jobs folder.

@codingfoo
codingfoo / boot.rb
Created January 20, 2014 23:12
Modify default rails server port
#config/boot.rb
require 'rails/commands/server'
module Rails
class Server
alias :default_options_alias :default_options
def default_options
default_options_alias.merge!(:Port => 3014)
end
end
@codingfoo
codingfoo / number.cpp
Created December 30, 2013 15:41
Example of strtol function
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int val;
char str[20];
strcpy(str, "0x00010");
@codingfoo
codingfoo / README
Last active December 17, 2015 16:39
Basic iptables config
https://help.ubuntu.com/community/IptablesHowTo
Place the scripts in
/etc/network/if-pre-up.d and /etc/network/if-post-down.d
@codingfoo
codingfoo / sax_vs_dom.rb
Last active December 11, 2015 20:59
Benchmark sax vs dom parsing for nokogiri
require 'nokogiri'
class MyDoc < Nokogiri::XML::SAX::Document
attr_reader :result
def initialize
@result = ""
end
def xmldecl version, encoding, standalone