Skip to content

Instantly share code, notes, and snippets.

View kasparsd's full-sized avatar

Kaspars Dambis kasparsd

View GitHub Profile
<?php
add_filter( 'cf7_entry_rows', function( $rows, $entry ) {
$attachments = get_post_meta( $entry->ID, 'mail_attachments', true );
if ( empty( $attachments ) ) {
return $rows;
}
@kasparsd
kasparsd / pick-sub-feedly-bookmarklet.js
Last active October 2, 2015 09:28
Pick feed and subscribe in Feedly
javascript:void%20function(){var%20e=document.getElementsByTagName(%22link%22);for(li%20in%20e)if(e[li].rel%26%26(-1!==e[li].type.indexOf(%22rss+xml%22)||-1!==e[li].type.indexOf(%22atom+xml%22))%26%26confirm(e[li].href))return%20void%20window.open(%22http://feedly.com/i/subscription/feed/%22+e[li].href,%22_blank%22);alert(%22No%20valid%20feeds%20found!%22)}();
@kasparsd
kasparsd / gd-info.php
Created October 24, 2015 20:13
GD on PHP7
<?php
// Output of gd_info()
Array
(
[GD Version] => bundled (2.1.0 compatible)
[FreeType Support] =>
[GIF Read Support] => 1
[GIF Create Support] => 1
[JPEG Support] =>
@kasparsd
kasparsd / not-working.log
Last active October 29, 2015 12:21
OpenSC IAS/ECC output of Latvia eID
0x7fff7b564000 14:21:04.140733193388674 [opensc-tool] sc.c:251:sc_detect_card_presence: called
0x7fff7b564000 14:21:04.140733193388674 [opensc-tool] reader-pcsc.c:384:pcsc_detect_card_presence: called
0x7fff7b564000 14:21:04.642 [opensc-tool] reader-pcsc.c:294:refresh_attributes: OMNIKEY AG Smart Card Reader check
0x7fff7b564000 14:21:04.643 [opensc-tool] reader-pcsc.c:313:refresh_attributes: returning with: 0 (Success)
0x7fff7b564000 14:21:04.140733193388675 [opensc-tool] reader-pcsc.c:389:pcsc_detect_card_presence: returning with: 5
0x7fff7b564000 14:21:04.643 [opensc-tool] sc.c:256:sc_detect_card_presence: returning with: 5
Using reader with a card: OMNIKEY AG Smart Card Reader
0x7fff7b564000 14:21:04.643 [opensc-tool] sc.c:251:sc_detect_card_presence: called
0x7fff7b564000 14:21:04.140733193388675 [opensc-tool] reader-pcsc.c:384:pcsc_detect_card_presence: called
0x7fff7b564000 14:21:04.643 [opensc-tool] reader-pcsc.c:294:refresh_attributes: OMNIKEY AG Smart Card Reader check
@kasparsd
kasparsd / not-working.log
Last active October 29, 2015 13:53
OpenSC IAS/ECC card matching
0x7fff7b564000 15:34:50.140733193388729 [opensc-tool] reader-pcsc.c:260:pcsc_transmit: reader 'OMNIKEY AG Smart Card Reader'
0x7fff7b564000 15:34:50.697 [opensc-tool] apdu.c:187:sc_apdu_log:
Outgoing APDU data [ 12 bytes] =====================================
00 A4 04 00 07 A0 00 00 01 51 00 00 .........Q..
======================================================================
0x7fff7b564000 15:34:50.4294967993 [opensc-tool] reader-pcsc.c:190:pcsc_internal_transmit: called
0x7fff7b564000 15:34:50.733 [opensc-tool] apdu.c:187:sc_apdu_log:
Incoming APDU data [ 113 bytes] =====================================
6F 6D 84 07 A0 00 00 01 51 00 00 A5 62 73 2F 06 om......Q...bs/.
07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 .*.H..k.`...*.H.
@kasparsd
kasparsd / latvia-id-pkcs15-dump.txt
Created October 29, 2015 20:29
PKCS#15 Dump of Latvia ID
PKCS#15 Card [LATVIA ID]:
Version : 1
Serial number : 010011758593312F
Manufacturer ID: Oberthur Technologies
Last update : 20141113152725Z
Flags : Login required, PRN generation
PIN [User PIN]
Object Flags : [0x0]
Auth ID : 02
@kasparsd
kasparsd / latvia-id-atr-verbose.txt
Last active November 4, 2015 16:07
Verbose output of opensc-tool -a for Latvia ID card
0x7fff77ce5000 17:10:56.140733193388158 [opensc-tool] sc.c:251:sc_detect_card_presence: called
0x7fff77ce5000 17:10:56.140733193388158 [opensc-tool] reader-pcsc.c:384:pcsc_detect_card_presence: called
0x7fff77ce5000 17:10:56.126 [opensc-tool] reader-pcsc.c:294:refresh_attributes: ACS ACR122U PICC Interface check
0x7fff77ce5000 17:10:56.127 [opensc-tool] reader-pcsc.c:313:refresh_attributes: returning with: 0 (Success)
0x7fff77ce5000 17:10:56.140733193388159 [opensc-tool] reader-pcsc.c:389:pcsc_detect_card_presence: returning with: 0 (Success)
0x7fff77ce5000 17:10:56.127 [opensc-tool] sc.c:256:sc_detect_card_presence: returning with: 0 (Success)
0x7fff77ce5000 17:10:56.127 [opensc-tool] sc.c:251:sc_detect_card_presence: called
0x7fff77ce5000 17:10:56.140733193388159 [opensc-tool] reader-pcsc.c:384:pcsc_detect_card_presence: called
0x7fff77ce5000 17:10:56.127 [opensc-tool] reader-pcsc.c:294:refresh_attributes: OMNIKEY AG Smart Card Reader check
0x7fff77ce5000 17:10:56.128 [opensc-tool] reader-pcsc.c:313:refresh
@kasparsd
kasparsd / icp.js
Last active November 17, 2015 23:02
_GPL.icp_perms = {
t: ["block_display", "adult", "bank", "internal", "legal", "pops_only", "provider", "technical", "toolbar", "google", "gov", "military", "block_pops"],
p: {
22555: {
b: [0]
},
a652c: {
a: 1,
b: [1, 2, 3, 4, 5, 6, 7, 8, 9]
},
@kasparsd
kasparsd / mke2fs.conf
Last active November 21, 2015 21:24
WD MyCloud EX2 RAID1 disk format
[defaults]
base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr
default_mntopts = acl,user_xattr
enable_periodic_fsck = 0
blocksize = 4096
inode_size = 256
inode_ratio = 16384
[fs_types]
ext3 = {
@kasparsd
kasparsd / pgp-publish.sh
Created November 21, 2015 23:34
Copy your PGP public key via SSH to your server
#!/bin/bash
# Stream your PGP public key via SSH to pgp.txt on your server
gpg --export -a | ssh user@example.com 'cat > ~/pgp.txt'