Skip to content

Instantly share code, notes, and snippets.

@jrom
jrom / test_generic.c
Created November 26, 2009 12:18
Code examples of OMP extensions for FPGA
/* Example 1, targeted code is a function */
#pragma omp target device(fpga) implements(matmul) copy_in( A[N], B[N] ) copy_inout( C[N] )
void matmul_fpga(int *A, int *B, int *C)
{
// Code that will run on the FPGA
}
#pragma omp task input( A[N], B[N] ) inout( C[N] )
void matmul(int *A, int *B, int *C)
{
#include <stdio.h>
#include "stdlib.h"
#include "string.h"
#include "sys/time.h"
#define SIZE (128*2048)
unsigned long long A[SIZE];
unsigned long long B[SIZE];
unsigned long long C[SIZE];
unsigned long long D[SIZE];
@jrom
jrom / typus_demo.rb
Created November 30, 2009 17:16
Typus template
##
# $ rails example.com -m http://tr.im/typus_example
##
# Install Typus and friends.
plugin 'typus', :git => 'git://github.com/fesplugas/typus.git'
plugin 'acts_as_list', :git => 'git://github.com/rails/acts_as_list.git'
plugin 'acts_as_tree', :git => 'git://github.com/rails/acts_as_tree.git'
plugin 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git'
--- courier-0.47/maildrop/main.C.orig 2004-11-22 12:23:09.000000000 +0100
+++ courier-0.47/maildrop/main.C 2004-11-22 12:23:19.000000000 +0100
@@ -718,38 +718,6 @@
++i;
}
-#if HAVE_COURIER
- if (deliverymode && orig_uid == getuid())
- {
- const char *p;
#!/bin/sh
# this file is a git post-update hook
# the file must be named post-update and be executable (chmod +x post-update)
# it must be in the .git/hooks directory
RAILS_ENV=production /path/to/retrospectiva/script/repository_syncer
echo "Retrospectiva was notified :-)"
require 'rubygems'
require 'wx'
class MyFrame < Wx::Frame
def initialize
super(nil, :title => "Thread example")
set_menu_bar menubar
timer = Wx::Timer.new(self, Wx::ID_ANY)
select first_name, last_name, email, locale, time_zone from users INTO OUTFILE '~/contacts.csv' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
require 'csv'
CSV.open("#{Rails.root}/../consumers.csv", "w") do |csv|
["Last login","Registration date","Organizations", "Projects count", "Organizations Plan", "name", "time_zone", "Language", "Email", "Phones", "Address"]
User.find_each(:include => [{:card => [:addresses, :phone_numbers]}, :organizations]) do |user|
print '.'
phones = []
if user.card
phones << user.card.phone_numbers.map(&:name).join(";") if user.card.phone_numbers
first_address = user.card.addresses.first
end
@jrom
jrom / devise.ca.yml
Created October 4, 2010 20:58 — forked from codegram/devise.ca.yml
Catalan translation for Devise
ca:
errors:
messages:
not_found: "no s'ha trobat"
already_confirmed: "ja està confirmat"
not_locked: "no està bloquejat"
not_saved:
one: "1 error ha evitat que %{resource} es pugui desar:"
other: "%{count} errors han evitat que %{resource} es pugui desar:"
@jrom
jrom / config.ru
Created October 27, 2010 00:02
Rack app that demonstrates Herkou limitation in header size
run lambda { |env|
headers = { "key"=> ("a" * 3455)} # 3454 works, 3455 don't
[200, headers, "Hello World!\n"]
}