Skip to content

Instantly share code, notes, and snippets.

View dedunumax's full-sized avatar

Dedunu Dhananjaya dedunumax

View GitHub Profile
<gconfentryfile>
<entrylist base="/apps/gnome-terminal">
<entry>
<key>global/active_encodings</key>
<schema_key>/schemas/apps/gnome-terminal/global/active_encodings</schema_key>
<value>
<list type="string">
<value>
<string>UTF-8</string>
</value>
@dedunumax
dedunumax / ImageCutter.java
Created May 2, 2014 09:37
This program will cut a single image into several image files
package org.dedunumax.imagecutter;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class ImageCutter {
public static void main(String[] args) throws IOException {
@dedunumax
dedunumax / Dedunu.bf
Last active August 29, 2015 14:01
Just print Dedunu.
+++++ +++++
[
> +++++ ++
> +++++ +++++
> +++++ +++++ +
<<< -
]
> -- .
> + .
- .
@dedunumax
dedunumax / .gitignore Java
Last active April 6, 2024 16:13
A complete .gitignore file for Java.
##############################
## Java
##############################
.mtj.tmp/
*.class
*.jar
*.war
*.ear
*.nar
hs_err_pid*
@dedunumax
dedunumax / redis-insert.sh
Created November 16, 2014 06:55
This command will insert first two columns of data.csv file into Redis database as key/value pair.
cat data.csv | awk -F',' '{print " SET \""$1"\" \""$2 "\"\n"}'| /opt/redis-2.8.17/src/redis-cli --pipe
@dedunumax
dedunumax / SwapInteger.java
Last active February 10, 2024 04:26
Swap two integer variables with out a third variable Java
public class SwapInteger{
public static void main(String args[]){
int a = 5;
int b = 10;
System.out.println("Before swapping.");
System.out.println("a = " + a);
System.out.println("b = " + b);
@dedunumax
dedunumax / kdtree-sample.js
Created March 4, 2015 10:37
KDTree example from NodeJS
/*
* You can download geo.txt from - https://github.com/Adslot/node-puzzle/blob/master/01-geo-lookup/data/geo.txt
*/
var fs = require('fs');
var kd = require('kdtree');
var kdtree = new kd.KDTree(3);
//var kdtree = new kd.KDTree(4);
@dedunumax
dedunumax / FileSizeWebScript.java
Last active January 3, 2024 16:01
Calculates folder size from given nodeRefId.
package org.dedunu.alfresco;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.NodeRef;
<webscript>
<shortname>File Size</shortname>
<description>Returns the file size of the given nodeRef</description>
<url>/size?nodeRef={RefForNode}</url>
<authentication>user</authentication>
<format default="html">extension</format>
<family>File Size Utilities</family>
</webscript>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Check file size</title>
</head>
<body>
<div>