Skip to content

Instantly share code, notes, and snippets.

View munen's full-sized avatar

Zen Monk Alain M. Lafon munen

View GitHub Profile
@munen
munen / nop_battle_entry.clj
Created December 16, 2010 13:33
My 'nop' battle entry
(comment
"We were doing a 'nop' battle in IRC today. First it was manual typing of 'nop's,
but quickly we got certain scripts running.
Learning clojure, I thought I could come over the top easily. And I did. I
defined a lazy cycling sequence containing 'nop', then I tried to get the last
entry of that list.
Unfortunately this didn't just burn my CPU (as I expected), but it also allocated
so much memory in seconds, that my X got shutdown by kernel.
@munen
munen / memcpy_demo
Created February 14, 2011 13:26
memcpy demo
#include <stdio.h>
int main() {
char source[] = "Foobar123";
char * target;
target = (char *) malloc(sizeof(source));
memcpy (target, source+1, sizeof(source));
// prints: "oobar123"
@munen
munen / compress_image.sh
Created May 1, 2011 19:45
Script for compressing images. Saves me about 25-30% of space with no visible difference. Measured on pictures from my 10MP camera.
#!/bin/bash
# Script for compressing images. Saves me about 17% of space with no visible
# difference. Measured on > 250 pictures from my 10MP camera.
for image in "$@"
do
# Make exif tag in jpg - set's the file's creation date.
jhead -mkexif $image
convert -resize 80% -quality 85 $image $image
@munen
munen / sopro2_restful_models_demo.rb
Created May 3, 2011 23:30
Example of a RESTful interface for sopro2
class TourHistory < ActiveRecord::Base
belongs_to :location
end
class LocationHistory < ActiveRecord::Base
has_many :tours
belongs_to :user
end
class User < ActiveRecord::Base
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="showdown.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script>
jQuery(document).ready(function() {
$('#leftContainer textarea').keyup(function() {
var input = $('#leftContainer textarea').val();
@munen
munen / merge_locales.rb
Created June 7, 2011 13:05 — forked from branch14/merge_locales.rb
Interactively merge several YAML files into one
#!/usr/bin/env ruby
#
# synopsis
#
# ruby merge_locales.rb config/locales translations.yml
require 'yaml'
require 'rubygems'
require 'highline/import'
struct {
int a;
union {
int b;
float c;
};
int d;
} foo;
Rails 3.x
install bundler
install rack
Possibly migrate to new gitosis: https://wiki.panter.ch/moin/git
Add bundler to project: http://gembundler.com/rails23.html
Add dependencies for POL from pol/README
diff --git a/app/views/pages/edit.html.haml b/app/views/pages/edit.html.haml
index c0e5a6a..f545605 100644
--- a/app/views/pages/edit.html.haml
+++ b/app/views/pages/edit.html.haml
@@ -9,7 +9,7 @@
#page_form{ :style => 'display: none;' }
!= render :partial => 'pages/form'
-#page_content{ }
+#page_content
@munen
munen / gist:1328630
Created October 31, 2011 19:41
git changes
diff --git a/app/views/layouts/pol.html.haml b/app/views/layouts/pol.html.haml
index 1340bfb..1b46a5c 100644
--- a/app/views/layouts/pol.html.haml
+++ b/app/views/layouts/pol.html.haml
@@ -3,11 +3,11 @@
%head
- content_for :title, "Panter llc - #{@page.title}"
!= render :partial => 'layouts/html_head'
- %meta(name='Description' content='Panter bietet umfassende, qualitativ hochstehende Beratungs-,Engineering- und Support-D
- %meta(name='Keywords' content='Consulting, Beratung, Software, Softwareentwicklung, Security, Monitoring, Interception, P