Skip to content

Instantly share code, notes, and snippets.

@jayankandathil
jayankandathil / cq_maintenance.sh
Last active September 27, 2016 14:31
Bash shell script to run Adobe CQ (Experience Manager) maintenance operations on Red Hat Enterprise Linux. Tested on RHEL 6.3 and 6.4
#!/bin/bash
# Bash script to run CQ daily maintenance operations, excluding TarPM Optimization and Tar Index Merge
# Author : Jayan Kandathil
# Version : 0.4
# Last updated : May 24, 2013
# Instructions : Copy to CQ's /bin folder, make necessary changes, enable the execute bit and run
@ryanlunka
ryanlunka / LinkTransformer.java
Created April 8, 2013 12:35
A Sling Rewriter Transformer that replaces all ".html" extensions in links within an HREF attribute of a requested page with "/".
package com.citytechinc.rewriter.linkchecker;
import java.io.IOException;
import org.apache.cocoon.xml.sax.AbstractSAXPipe;
import org.apache.sling.rewriter.ProcessingComponentConfiguration;
import org.apache.sling.rewriter.ProcessingContext;
import org.apache.sling.rewriter.Transformer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@jaseg
jaseg / gist:5296519
Last active March 23, 2016 10:08
zsh unicode table using only zsnexpn(1) in <140 characters

The following line produces a unicode table (decimal value and unicode characters) using only zsh * expansion, * substitution and the print-builtin.

setopt extendedglob histsubstpattern multibyte
print -ac ${${(A)=u::={5126..5743}}:s/#%(#b)(*)/'${(r:6:m)match[1]}${(#mr:4:)match[1]}'/}

Output:

//Provide details around the bootdelgation state
println "Bootdelgation property value :- "+bundleContext.getProperty("org.osgi.framework.bootdelegation")
println "Felix bootdelgation entries"
bundleContext.bundle.framework.bootPackages.each {
println it
}
###
# Scheme code is translated to YARV byte code, then evaluated in the
# Ruby Virtual Machine
require 'rbconfig'
require 'dl'
require 'fiddle'
require 'strscan'
class RubyVM
@sent-hil
sent-hil / pictures.markdown
Created August 24, 2012 02:18
River (getriver.com): Keep a programming journal.

One of my favorite past times is to look at the notebooks of famous scientists. Da Vinci's notebook is well known, but there plenty others. Worshipping Da Vinci like no other, I bought a Think/Create/Record journal, used it mostly to keep jot down random thoughts and take notes. This was great in the beginning, but the conformity of lines drove me nuts. Only moleskines made blank notebooks, so I had to buy one.

At the same time I started a freelance project. The project itself is irrelevant, but suffice to say it was very complex and spanned several months. It seemed like a perfect opportunity to use the moleskine. Looking back, all my entries fell under few categories:

  • Todo
  • Question
  • Thought
  • Bug
  • Feature
@megakorre
megakorre / rust-poly.md
Created August 8, 2012 21:47
blog: rust pollymorpism

EDIT! full code can be found here gist

So I played around with rust a bit now. And I thought I might share some random stuff.

So say you wanted to represent a expression tree with plus and minus nodes and a node for values. One way to do this would be to use rust's enum's.

In rust enums are like haskell's union types so you can specify the different values to be constructors carrying data.

@ckirkendall
ckirkendall / clojure-match.clj
Created June 15, 2012 02:26 — forked from bkyrlach/Expression.fs
Language Compare F#, Ocaml, Scala, Clojure, Ruby and Haskell - Simple AST example
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})
@leegao
leegao / Swap.c
Created January 19, 2011 22:45
C is fucking crazy.
#include <stdio.h>
void(*swap)() = (void(*)()) "\x8b\x44\x24\x04\x8b\x5c\x24\x08\x8b\x00\x8b\x1b\x31\xc3\x31\xd8\x31\xc3\x8b\x4c\x24\x04\x89\x01\x8b\x4c\x24\x08\x89\x19\xc3"
"Oh, there you are Mr. Insanity...";
int main(){ // works on GCC 3+4
int a = 37, b = 13;
swap(&a, &b);
printf("%d%d",a,b);
}
@pete
pete / 0-README
Last active February 10, 2024 07:12
Various implementations of the 'cat' command, for comparison.
I turned this gist into a "real" repository. It is here: http://github.com/pete/cats .
Here, placed side-by-side for comparison, are GNU's implementation of
cat, Plan 9's implementation, Busybox's implementation, and NetBSD's
implementation, Seventh Edition Unix (1979), and 4.3BSD.
For good measure (and because I suppose I am now committed to collecting
cats) also included are Second Edition Unix (in assembly) and Inferno's
implementation (in Limbo) for good measure.