Skip to content

Instantly share code, notes, and snippets.

<?php // {custom_module}/src/Plugin/migrate/process/CustomFile.php Replace {custom_nodule} with your module's machine name
namespace Drupal\{custom_module}\Plugin\migrate\process; // Replace {custom_nodule} with your module's machine name
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\file\Plugin\migrate\process\d6\CckFile;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* @MigrateProcessPlugin(
@thlor
thlor / date.php
Created October 18, 2016 11:19
new \DateTime() returns an object where the timezone is already set to the user's time zone.
<?php
$time = new \DateTime();
$default = $time->format('d.m.Y H:i');
// 18.10.2016 12:17
$user_timezone = drupal_get_user_timezone();
$timezone = new \DateTimeZone($user_timezone);
$time->setTimezone($timezone);
$with_user_timezone = $time->format('d.m.Y H:i');

Jump one directory up: cd ..

jump to subdirectory: cd directory_name

list contents of directory: dir

python location: C:\python34

@thlor
thlor / phishing.eml
Created October 24, 2018 11:26
phishing email
Return-path: <VWGARCIA@puce.edu.ec>
Received: from mail6.bemta26.messagelabs.com ([85.158.142.43])
by gwgwia.donau-uni.ac.at with ESMTP; Wed, 24 Oct 2018 10:47:06 +0200
Return-Path: <VWGARCIA@puce.edu.ec>
Received: from [85.158.142.98] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits))
by server-3.bemta.az-a.eu-central-1.aws.symcld.net id 21/C9-08707-98130DB5; Wed, 24 Oct 2018 08:47:05 +0000
Subject: **** You_got_SPAM **** Sie haben {1} eine neue wichtige
Nachricht
X-Brightmail-Tracker: H4sIAAAAAAAAA1VTbUxbZRTu23t775VRc1fAviObcU38o2nXZsY
doptLIMviD5zTZImY4N2obWOp2I/IFjO6FhxQuy6hQGUIZRsbn1M6nUyKrTBm6fjamNMRPvwg
@thlor
thlor / ckan_crawler.py
Created November 14, 2018 15:54
CKAN crawler
# First install CKANapi module from the command line:
# pip3 install ckanapi
from ckanapi import RemoteCKAN
import json
with RemoteCKAN("https://www.data.gv.at/katalog/", get_only=True) as ckan:
page = 0
rows = 100
limit_pages = 10 # Limit number of pages to be crawled. DEBUG reasons. Set this to -1 to crawl unlimited pages.
@thlor
thlor / natas11_walkthrough.php
Created November 20, 2018 15:23
natas11 walkthrough
<?php
// See: http://natas11.natas.labs.overthewire.org/
// The color code is stored in a cookie.
// Cookie not legible (as we know it's encrypted by XOR)
// From the PHP source we see that:
// - cookie is also base64 encoded (find: base_encode() and base_decode() in source)
// - once decrypted, cookie contents are a json string (find: json_encode() and json_decode() in source)
// - this json has (at least) these two keys: "showpassword", "bgcolor" (see $data['bgcolor'] and $data['showpassword']
// - we confirm our suspicion based on from php/html source that "bgcolor" stores the background color we change and "showpassword" value decides whether password is shown (default: no, desired: yes)
@thlor
thlor / deduper_fails.
Created June 12, 2019 14:44
deduper fails
2019-06-12 14:26:17,917 [ERROR] django.request: Internal Server Error: /dedup/push_file/update/austrian_open_data_searchresult
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
response = self._get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
@thlor
thlor / crawler_log.py
Created June 12, 2019 14:51
crawler log
/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
#1 Ingest: 500, mtdtID: 0a9ad2e8-6333-42eb-bbd1-c67a76837d64, hashEntries: ?, ConduitDone: ?, 2019-06-12 14:21:40 "mapping-zwischen-kunstwerk-und-ausstellung-der-sammlung-des-mumok"
#2 Ingest: 500, ddpHash: 7cf2c38c278ce7d162524eeedb735987dee3f1b96237b9ff01200e194727ab7c, hashEntries: 0, ConduitDone: None, performedMapping: False, 2019-06-12 14:21:40 "basiskulturwien"
#3 Ingest: 500, mtdtID: d686f8a6-f683-47df-8b16-329f84e2b28f, hashEntries: ?, ConduitDone: ?, 2019-06-12 14:21:41 "off"
#4 Ingest: 500, ddpHash: a651089b3a99a980c217d6d38934083027e1d64e310d28cdcf9812aef72c9114, hashEntries: 0, ConduitDone: None, performedMapping: False, 2019-06-12 14:21:41 "dtm-belgium"
#5 Ingest: 500, ddpHash: 6e1d022f2b3b61b14f2cb4314751541596944cffe7abaf2c4d331b3e
@thlor
thlor / id-kaart-ssh.md
Created April 20, 2020 10:53 — forked from KaarelP2rtel/id-kaart-ssh.md
SSH sisselogimine ID Kaardiga - muljeid aastast 2019

SSH autentimine ID Kaardiga - muljeid aastast 2019

(English version below)

Juhiseid, kuidas ID-Kaardiga logida SSH kaudu sisse on kirjutatud juba 2011 aastast. Kirjutan natuke oma tähelepanekutest 2019 aastal ning ka sellest, kuidas kasutada ID Kaarti Windowsis Puttyga.

Smartcardi kasutamine võimaldab SSH ligipääsu erinevatest masinatest nii, et ei pea hakkama igas masinas võtmeid genereerima või masinate vahel võtmeid kopeerima. ID Kaart peaks olema enamustel Eestlastel olemas olema, seega hea võimalus on seda ära kasutada.

Linux (Ubuntu 19.10+)

1. Vajalik tarkvara

openssh-client versioon 8+