Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MathNet.Numerics.LinearAlgebra;
namespace MatrixMul
{
class Program
{
@mad
mad / gist:763731
Created January 3, 2011 17:54
Reading files from the linux kernel
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
MODULE_LICENSE("GPL");
static int __init init_lkm (void)
{
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
require 'rexml/document'
require '../lab1/static_auth.rb'
# Used for inteprete tags from card and decrypt cert and static auth
class CardReader
attr_accessor :dynamic_tags, :card_dynamic_info, :dynamic_auth
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
require 'rexml/document'
# Calculate a modular exponentiation eg: b^p mod m
# http://en.wikipedia.org/wiki/Modular_exponentiation
class Integer
def mod_pow(power, mod)
base, result = self.to_i, 1
#!/usr/bin/ruby -wKU
# -*- coding: utf-8 -*-
require 'cgi'
require 'uri'
require 'net/http'
require 'nokogiri'
require 'pp'
# TODO: think about easily add new tracking system!
@mad
mad / gist:939777
Created April 24, 2011 18:29
Обработка csv файла на Java
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Calendar;
import au.com.bytecode.opencsv.CSVReader;
import au.com.bytecode.opencsv.CSVWriter;
public class Main {
(ns wf
(:require (clojure.java.io/writer))
(:use [clojure.contrib.seq :only (indexed)])
(:import java.util.concurrent.atomic.AtomicLong))
(set! *warn-on-reflection* true)
;;; Big wins:
;;; * Use queue instead of pmap.
;;; * Overlap chunking with actual runtime
#include <iostream> // cout, endl
#include <fstream> // fstream
#include <vector>
#include <string>
#include <algorithm> // copy
#include <iterator> // ostream_operator
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
struct number_rule {
char *before_mask;
char *after_mask;
char am_len;
char bm_len;
int amp_len;
int bmp_len;
};
struct number_rules {