Skip to content

Instantly share code, notes, and snippets.

@Znarkus
Znarkus / Output
Last active October 3, 2016 07:51
Transaction test Postgres
$ DB_POOL_MIN=1 DB_POOL_MAX=1 node -r dotenv/config -r babel-register -r babel-polyfill scripts/dev/trx-test.js
knex:tx trx1: Starting top level transaction +0ms
knex:tx trx2: Starting top level transaction +13ms
bolt:knex:query { bindings: undefined, sql: 'BEGIN;' } +61ms
bolt:knex:query { bindings: [], sql: 'select * from testt' } +16ms
bolt:knex:query { bindings: [ 1 ], sql: 'update testt set counter = counter + 1 where id = ?' } +4ms
AFTER UPDATE id 1
AFTER 5s DELAY id 1
bolt:knex:query { bindings: undefined, sql: 'COMMIT;' } +5s
knex:tx trx1: releasing connection +2ms
@Znarkus
Znarkus / keybase.md
Last active December 30, 2015 09:02
keybase.md

Keybase proof

I hereby claim:

  • I am znarkus on github.
  • I am znarkus (https://keybase.io/znarkus) on keybase.
  • I have a public key whose fingerprint is 6603 9274 77F4 9477 11E3 0210 A2D8 CA0E F5B6 31BF

To claim this, I am signing this object:

'use strict';
var Sequelize = require('sequelize');
var sequelize = new Sequelize('mysql://[email protected]/test');
var Promise = require('bluebird');
var Person;
var PersonRole;
var Role;
var Product;
var Account;
@Znarkus
Znarkus / gist:30007a6af394335b492c
Last active August 29, 2015 14:00
Instagram Photo Downloader Bookmarklet
//location = $('.iMedia div').css('background-image').match(/url\(['"]*(.+)['"]*\)/)[1]
$('<a>', {
href: $('.iMedia div').css('background-image').match(/url\(['"]*(.+)['"]*\)/)[1],
download: ''
}).text('Download Photo').css({
position: 'fixed',
left: '50%',
top: '50%',
zIndex: 9999,
@Znarkus
Znarkus / changeUrlParam.js
Last active December 22, 2015 08:18
Change a query parameter in the current URL.
function changeUrlParam(paramName, newValue) {
var search = location.search.replace(new RegExp('[?&]' + paramName + '=[^&]+'), ''),
url = location.pathname + search;
if (newValue !== null) {
url += (search ? '&' : '?') +
paramName + '=' + newValue;
}
location = url;
@Znarkus
Znarkus / jquery.imgNaturalSize.js
Last active December 20, 2015 19:39
Get natural img size.
imgNaturalSize($img, function (width, height) {
// $img is now loaded
});
$ "/Applications/Luminance HDR 2.3.1.app/Contents/MacOS/align_image_stack" -v -a aligned_ _MG_5141.CR2 _MG_5142.CR2 _MG_5132.CR2
_MG_5141.CR2: Warning, incorrect count for field "BitsPerSample" (3, expecting 1); tag trimmed.
libc++abi.dylib: terminate called throwing an exception
Abort trap: 6
echo 'onload="src"+='#'+document.location"';
^ ^
här här
börjar avslutar
strängen du
den
@Znarkus
Znarkus / patch
Last active April 27, 2017 10:13
Disable URI validation in HTML Purifier

Disable URI validation in HTML Purifier

You need to regenerate schema.ser, use maintenance/generate-schema-cache.php.

~# iptables -L OUTPUT
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ufw-before-logging-output all -- anywhere anywhere
ufw-before-output all -- anywhere anywhere
ufw-after-output all -- anywhere anywhere
ufw-after-logging-output all -- anywhere anywhere
ufw-reject-output all -- anywhere anywhere
ufw-track-output all -- anywhere anywhere