Skip to content

Instantly share code, notes, and snippets.

(ns pdms.core
(:use korma.core
[korma.db :only (defdb)]))
(def db-spec {:subprotocol "postgresql"
:subname "//localhost/pdms"
:user "huleehom"
:password ""})
(defdb db db-spec)
@stingh711
stingh711 / .vimrc
Created June 24, 2014 08:19
My vimrc
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle
call vundle#begin()
Plugin 'gmarik/vundle'
"Plugin 'ervandew/supertab'
Plugin 'nanotech/jellybeans.vim'
Plugin 'scrooloose/nerdtree'
@stingh711
stingh711 / test.sql
Created June 26, 2014 03:38
Sql to get home page
SELECT
a.*, c.categoryName as articleCategoryName
FROM
ctms_article a
LEFT JOIN ctms_article b ON a.articleCategoryId = b.articleCategoryId
AND a.lastModified < b.lastModified
LEFT JOIN ctms_article_category c ON a.articleCategoryId = c.articleCategoryId
WHERE
a.state = 1
GROUP BY
@stingh711
stingh711 / gist.html
Created March 14, 2012 08:50
How to embed gist
<html>
<body id="Hallo" onload="">
<script src="https://gist.github.com/2035118.js"> </script>
</body>
</html>
@stingh711
stingh711 / pom.xml
Created March 20, 2012 03:25
pom.xml for a spring mvc project
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.zyxel</groupId>
<artifactId>sting</artifactId>
<name>abc</name>
<packaging>war</packaging>
<version>1.0.0-BUILD-SNAPSHOT</version>
<properties>
@stingh711
stingh711 / changelog.xml
Created March 22, 2012 10:11
Liquibase change log
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
<changeSet author="sting (generated)" id="1307605540491-1">
<createTable tableName="ADDRESSES">
<column name="ID" type="INT">
<constraints nullable="false" primaryKey="true" primaryKeyName="CONSTRAINT_D"/>
</column>
<column name="NAME" type="VARCHAR(255)"/>
</createTable>
</changeSet>
class MyMeta(type):
def __init__(cls, name, bases, attrs):
print "__init__ is called"
type.__init__(cls, name, bases, attrs)
def __call__(cls, *args, **kargs):
print "I am called"
return type.__call__(cls, *args, **kargs)
def __setattr__(cls, name, value):
@stingh711
stingh711 / sysctl.conf
Created July 9, 2012 06:21
Adjust kernel network parameters
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.core.rmem_default=65536
net.core.wmem_default=65536
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
net.ipv4.tcp_mem=16777216 16777216 16777216
net.ipv4.route.flush=1
net.core.netdev_max_backlog=30000
net.ipv4.udp_mem=16777216 16777216 16777216
@stingh711
stingh711 / MinorGc.java
Created July 17, 2012 04:51
Test minor GC
private static final int _1M = 1024 * 1024;
/**
* Test with -verbose:gc -XX:+PrintGCDetails -Xms20M -Xmx20M -Xmn10M
*/
public void testMinorGc() {
byte[] a1, a2, a3, a4;
a1 = new byte[_1MG / 2];
System.out.println(1);
a2 = new byte[3 * _1MG];
@stingh711
stingh711 / MaxTenuringThreshold.java
Created July 17, 2012 06:20
Test MaxTenuringThreshold
private static final int _1M = 1024 * 1024;
/**
* Test with -verbose:gc -XX:+PrintGCDetails -Xms20M -Xmx20M -Xmn10M -XX:MaxTenuringThreshold=1
*/
public static void testMaxTenuringThreshold() {
byte[] a1, a2, a3;
a1 = new byte[_1M / 4];
System.out.println(1);