Skip to content

Instantly share code, notes, and snippets.

@btmash
btmash / get_all_repositories.sh
Created October 24, 2023 16:51
Get all repos from AWS Codecommit (with optional capability to use parallel if your system has it)
#!/bin/bash
REPOSITORIES=$(aws codecommit list-repositories --sort-by repositoryName --query 'repositories[].repositoryName' --output text)
if ! command -v parallel &> /dev/null
then
for REPO in $REPOSITORIES
do
bash ./get_repo.sh $REPO
done
@btmash
btmash / SocialFeedCommands.php
Last active March 18, 2019 20:24
SocialFeedCommands.php ported
<?php
namespace Drupal\social_feed\Commands;
use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
use Drush\Commands\DrushCommands;
use Drupal\Core\Queue\QueueInterface;
use Drupal\Core\Queue\QueueWorkerInterface;
use Drupal\Core\Queue\SuspendQueueException;
@btmash
btmash / composer.json
Created March 18, 2019 18:46
Composer.json file (/social_feed/) before running generate
{
"name": "drupal/social_feed",
"type": "drupal-module",
"description": "Provides user an option to easily fetch feeds from Facebook, Twitter or Instagram and then display them accordingly using block",
"keywords": ["Drupal"],
"license": "GPL-2.0+",
"homepage": "https://www.drupal.org/project/social_feed",
"minimum-stability": "dev",
"support": {
"issues": "https://www.drupal.org/project/issues/social_feed",
@btmash
btmash / gist:95265a63e510374b0562a140395c78cf
Last active June 22, 2018 19:42
Delete Research nodes revisions
<?php
// Query all of the nids of the research content type.
$nids = db_select('node', 'n')
->fields('n', array('nid'))
->condition('type', 'research', '=')
->execute()
->fetchCol();
foreach ($nids as $nid) {
@btmash
btmash / ashok.info.yml
Created February 13, 2018 21:36
This adds libraries conditionally in d8
name: 'Ashok Test'
type: module
description: Test loading libraries conditionally
core: 8.x
@btmash
btmash / btm-migrate-d8.sql
Created April 8, 2017 21:57
Things I could fix via sql to get the site to show up properly.
update node__body set body_format = 'basic_html' WHERE body_format = 'filtered_html';
update node_revision__body set body_format = 'basic_html' WHERE body_format = 'filtered_html';
update node__body SET body_value = REPLACE(body_value, '<pre>', '');
update node_revision__body SET body_value = REPLACE(body_value, '<pre>', '');
update node__body SET body_value = REPLACE(body_value, '</pre>', '');
update node_revision__body SET body_value = REPLACE(body_value, '</pre>', '');
update node__body SET body_value = REPLACE(body_value, '<code', '<pre><code');
@btmash
btmash / islandora_marcxml_custom_xsl.patch
Last active August 29, 2015 14:18
Create custom forms.
diff --git a/includes/admin.form.inc b/includes/admin.form.inc
new file mode 100644
index 0000000..8970475
--- /dev/null
+++ b/includes/admin.form.inc
@@ -0,0 +1,26 @@
+<?php
+
+function islandora_marcxml_settings($form, &$form_state) {
+ $form['islandora_marcxml_mods_to_marc_xsl_path'] = array(
@btmash
btmash / ec-manage-snapshots.php
Created May 9, 2014 22:13
Using awscli to manage ec2 snapshots (creation, cleanup) with php.
<?php
// Using awscli for this. Would probably be better in python but this was quick and simple.
date_default_timezone_set ('UTC');
/**
* Executes aws command and returns output as PHP array.
*/
function _exec_aws_command($command) {

Keybase proof

I hereby claim:

  • I am btmash on github.
  • I am btmash (https://keybase.io/btmash) on keybase.
  • I have a public key whose fingerprint is B6EE DE30 500F 1770 2B57 943F 46CF A036 29F6 EA1E

To claim this, I am signing this object:

@btmash
btmash / de_migration_product.inc
Created June 7, 2012 23:02
DE Migration Example SOURCE::DESTINATION code
<?php
class DEMigrationCommerceProductMigration extends Migration {
protected $file_public_path = "";
protected $source_drupal_root = "";
public function __construct() {
parent::__construct();
$this->systemOfRecord = Migration::DESTINATION;