Skip to content

Instantly share code, notes, and snippets.

View PickledDragon's full-sized avatar
🏠
Working from home

Praveen Kottarathil PickledDragon

🏠
Working from home
View GitHub Profile
var NAME_FILTER_THROTTLE_DELAY = 350;// ms
function throttle(fn, delay) {
var timer = null;
return function () {
var context = this, args = arguments;
clearTimeout( timer );
timer = setTimeout( function(){ fn.apply( context, args ); }, delay );
};
}
$( "#targetElementID:not(.eventBound)" ).addClass( "eventBound" ).keyup( eventHandlerName );
/******************************/
(function($) {
//Stuff goes here.
$.fn.doSomethingMethod = function() {
var targetElement = this.get( 0 );
}
#Hibernate logging
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
# Root logger option
log4j.rootLogger=INFO, file, stdout
@PickledDragon
PickledDragon / list-constraints.sql
Created October 25, 2015 11:30
Postgres list all constraints
SELECT
tc.constraint_name, tc.table_name, kcu.column_name,
ccu.table_name AS foreign_table_name,
ccu.column_name AS foreign_column_name
FROM
information_schema.table_constraints AS tc
JOIN information_schema.key_column_usage AS kcu
ON tc.constraint_name = kcu.constraint_name
JOIN information_schema.constraint_column_usage AS ccu
ON ccu.constraint_name = tc.constraint_name
SELECT 'ALTER TABLE '||nspname||'.'||relname||' ADD CONSTRAINT '||conname||' '|| pg_get_constraintdef(pg_constraint.oid)||';'
FROM pg_constraint
INNER JOIN pg_class ON conrelid=pg_class.oid
INNER JOIN pg_namespace ON pg_namespace.oid=pg_class.relnamespace
ORDER BY CASE WHEN contype='f' THEN 0 ELSE 1 END DESC,contype DESC,nspname DESC,relname DESC,conname DESC;
SELECT 'ALTER TABLE '||nspname||'.'||relname||' DROP CONSTRAINT '||conname||';'
FROM pg_constraint
INNER JOIN pg_class ON conrelid=pg_class.oid
INNER JOIN pg_namespace ON pg_namespace.oid=pg_class.relnamespace
From : https://www.linkedin.com/pulse/20140903131536-29650941-20-phrases-for-closing-an-email
A common problem
We often hear how writing emails in English can cost just too much time. One solution that works for many people is to begin building a “toolbox” of useful phrases. A toolbox is a simple idea – you just start keeping a list of common and useful expressions – perhaps on your desktop or in a notebook next to your keyboard? There’s nothing wrong with reusing some standard phrases if it helps save you time and communicate clearly. You probably already have 2 or 3 sentences you reuse again and again. But sometimes the tone just isn’t right, is it? To help you find the right words when you need them here are 20 great expressions for closing an email. As you read through them ask yourself two simple questions:
1. When would I use this?
2. When will I use this?
Expressions for thanking
@PickledDragon
PickledDragon / dovecot-move-nonspam-from-junk.sh
Created February 8, 2016 15:09
dovecot move nonspam from junk
grep -L -r 'X-Spam-Status: Yes' .Junk/new | xargs -I{fname} mv {fname} ./new/
grep -L -r 'X-Spam-Status: Yes' .Junk/cur | xargs -I{fname} mv {fname} ./new/
* Boot with live CD
* Drop into root console
* Use 'lsblk' to list device details
* cryptsetup luksDump <device-name> to see howmany key slots are available
* cryptsetup luksAddKey <device-name> to add new key
Follow https://github.com/patjak/bcwc_pcie
## Firmware extraction
Download the driver (zip version) and extract it by following these steps:
* Clone the git repository with `$ git clone https://github.com/patjak/bcwc_pcie.git`
* Change to the firmware directory with `$ cd bcwc_pcie/firmware`
* Under bcwc_pcie-master/firmware type `$ make` and then as root type `# make install`
* Result should be like: