Skip to content

Instantly share code, notes, and snippets.

View dumityty's full-sized avatar

Constantin Titi Dumitrescu dumityty

View GitHub Profile
@krakjoe
krakjoe / crawler.php
Last active October 11, 2023 19:07
parallel Futures, Channels (buffered, unbuffered, synchros), Events using parallel producer/consumer pattern
<?php
use \parallel\{Runtime, Future, Channel, Events};
/* usage php crawler.php [http://example.com] [workers=8] [limit=500] */
$page = $argv[1] ?: "https://blog.krakjoe.ninja"; # start crawling this page
$workers = $argv[2] ?: 8; # start this number of threads
$limit = $argv[3] ?: 500; # stop at this number of unique pages
$timeout = $argv[4] ?: 3; # socket timeout for producers
Install PHP 7.1
sudo update-alternatives --set php /usr/bin/php7.0
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.1
php -v
PHP 7.1 Modules list (Example)
<?php
/**
* This plugin creates a new paragraph entity based on the source.
*
* @MigrateProcessPlugin(
* id = "mds_paragraph"
* )
*/
class ParagraphMigrateProcessor extends ParagraphProcessBase {
@pfaocle
pfaocle / NodeParagraphTextarea.php
Created October 19, 2016 08:57
Migrate D6 node body into D8 Paragraphs field
<?php
/**
* @file
* Migrate D6 node body into D8 Paragraphs field.
*
* @see http://www.amitgoyal.in/2016/03/d6-d8-migration-d6-body-d8-paragraph-type-text.html
*/
namespace Drupal\ixis_migrate_from_d6\Plugin\migrate\process;
@akshaybabloo
akshaybabloo / get_dns_records.py
Last active May 9, 2024 13:22
Printing all DNS records using DNSPython in Python 3
#!/usr/bin/env python
# -*- coding utf-8 -*-
#
# Copyright 2016 Akshay Raj Gollahalli
import dns.resolver
def get_records(domain):
"""
@justinpawela
justinpawela / config
Created August 3, 2016 01:39
AWS CodeCommit Multiple Account Config
# This file is: ~/.ssh/config
# You may have other (non-CodeCommit) SSH credentials stored in this
# config file – in addition to the CodeCommit settings shown below.
# NOTE: Make sure to run [ chmod 600 ~/.ssh/config ] after creating this file!
# Credentials for Account1
Host awscc-account1 # 'awscc-account1' is a name you pick
Hostname git-codecommit.us-east-1.amazonaws.com # This points to CodeCommit in the 'US East' region
OpsWorks stack RGB color value reference, with closest possible english names that I could think of.
For use in CLI or other non GUI tools like Terraform.
Cosmic Purple : rgb(135, 61, 98)
Purple: rgb(111, 86, 163)
Blue: rgb(45, 114, 184)
Teal: rgb(38, 146, 168)
Green: rgb(57, 131, 94)
Olive Drab: rgb(100, 131, 57)
Mustard yellow (golden): rgb(184, 133, 46)
@paullinney
paullinney / gist:24b8c27d17c188d620e2
Created October 23, 2014 10:44
Drush Alias Ignore Tables
'source-command-specific' => array (
'sql-sync' => array (
'no-cache' => TRUE,
'structure-tables-key' => 'common',
),
),
'command-specific' => array (
'sql-sync' => array (
'structure-tables' => array(
'common' => array('cache', 'cache_block', 'cache_content', 'cache_filter', 'cache_form', 'cache_menu', 'cache_page', 'cache_rules', 'cache_update', 'cache_views', 'cache_views_data', 'ctools_css_cache', 'ctools_object_cache', 'search_dataset', 'search_index', 'search_node_links', 'search_total', 'accesslog', 'history', 'watchdog')
@janikvonrotz
janikvonrotz / Unattended Encrypted Incremental Backup to Amazon S3.md
Last active May 8, 2020 08:00
Ubuntu: Unattended Encrypted Incremental Backup to Amazon S3#AmazonAWS#Markdown

Introduction

For this task we are going to configure a duplicity script wrapper. Unregarded of the installation instructions it's expected that you have already signed up for an Amazon account and know how to use their services.

Requirements

  • Ubuntu server
  • duplicity, Git, GnuPG
  • MySQL
@anthonyringoet
anthonyringoet / template.php
Created April 16, 2012 12:12
aggregate drupal css and js in ONE file each, not one file per group
<?php
function hook_js_alter(&$js){
uasort($js, 'drupal_sort_css_js');
$i = 0;
foreach($js as $name => $script) {
$js[$name]['weight'] = $i++;
$js[$name]['group'] = JS_DEFAULT;
$js[$name]['every_page'] = FALSE;
$js[$name]['scope'] = 'footer';