Skip to content

Instantly share code, notes, and snippets.

View DonRichards's full-sized avatar

Don Richards DonRichards

View GitHub Profile
@mjordan
mjordan / get_all_mods_fields_in_solr.sh
Created January 16, 2020 00:50
Shell script to get all the Solr fields indexed from MODS elements
#!/bin/bash
SOLR_HOST='http://192.168.50.111:8080'
SOLR_URL="$SOLR_HOST/solr/select?q=*:*&wt=csv&rows=0&facet&fl=mods_*"
curl -s -o mods_elements.txt "$SOLR_URL"
sed 's/,/\n/g' mods_elements.txt > mods_elements_one_per_line.txt
sed 's/_mlt$// ; s/_ms$// ; s/_mt$// ; s/_s$// ; s/_ss$// ; s/_t$// ; s/_all$// ; s/_dt$// ; s/_mdt$//' mods_elements_one_per_line.txt > mods_elements_one_per_line.txt.pruned
sort mods_elements_one_per_line.txt.pruned > mods_elements_one_per_line.txt.pruned.sorted
uniq mods_elements_one_per_line.txt.pruned.sorted > mods_elements.txt
@adamzimmermann
adamzimmermann / migrate.sh
Last active March 11, 2024 11:08
Migration Script with Limit/Looping
#!/bin/bash
migrate_loop()
{
# Better readability with separation.
echo "========================";
# Get the output of the drush status.
drush_output=$(drush ms "$1" --format string);
# Split output string into an array.
@ElliotNB
ElliotNB / notify.sh
Last active December 5, 2023 02:35
Email sysadmin on every login from a new IP address
#!/bin/bash
##
## New IP login notification script
## 2009-11-20 00:28 Samuele ~redShadow~ Santi
## 2018-06-04 12:53 ElliotNB
## 2018-10-17 17:55 ElliotNB - bug fixes for non-interactive sessions and `sudo su` commands
## Licensed under GPL
##
## This script will email the contact specified below whenever
## a user logs into the system from a new IP address. The email will contain the
@druman
druman / d8.php
Last active January 11, 2022 19:36
Drupal 8 tweaks
<?php
// thx drupal8.ovh
//// 1) How to get the current language in Drupal 8
//To get the lanuage code:
$language = \Drupal::languageManager()->getCurrentLanguage()->getId();
//To get the language name:
$language = \Drupal::languageManager()->getCurrentLanguage()->getName();
@BenTheElder
BenTheElder / find_nonmembers.py
Created August 10, 2017 00:12
find contributors that are not members of an organization
#!/usr/bin/env python
from __future__ import print_function
import re
import json
import argparse
from collections import defaultdict
import requests
parser = argparse.ArgumentParser(
@WengerK
WengerK / README.md
Last active January 4, 2022 21:15
Programatically use Solr on Drupal 8

🔍 Solr (6.1.0+) search Engine & Tika (1.13+) Extractor

We are using solr for search index.

Solr need to be configured for drupal. Follow the INSTALL.txt found in the search_api_solr module.

As a pre-requisite for running your own Solr server, you'll need Java 6 or higher.

Installation

@n8felton
n8felton / osx_cleanup.sh
Last active August 31, 2017 11:46
OS X Cleanup
#!/bin/bash
# https://github.com/n8felton/DeployStudio/blob/master/DeployStudio%20Admin.app/Contents/Frameworks/DSCore.framework/Versions/A/Resources/Tools/osxcleanup.sh
# https://managingosx.wordpress.com/2009/01/23/image-cleanup-script/
# https://wikis.uit.tufts.edu/confluence/display/exchange2010/Remove+account+in+Single+User+mode
# Copy this script to /private/var/root/.profile
echo Check and mount disk
/sbin/fsck -fy
/sbin/mount -uw /
@tkhduracell
tkhduracell / fix.sh
Last active February 19, 2023 13:09
Fix locale on raspberry pi (raspbian) "Setting locale failed."
#
# How to get rid of the locale warning on raspberry pi
#
sudo sed -i "s/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g" -i /etc/locale.gen
sudo locale-gen en_US.UTF-8
sudo update-locale en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
@yyx990803
yyx990803 / starcounter.js
Last active March 24, 2024 05:25
Count your total stars!
var https = require('https'),
user = process.argv[2],
opts = parseOpts(process.argv.slice(3))
request('/users/' + user, function (res) {
if (!res.public_repos) {
console.log(res.message)
return
}
var pages = Math.ceil(res.public_repos / 100),