Skip to content

Instantly share code, notes, and snippets.

View greggles's full-sized avatar

Greg Knaddison greggles

View GitHub Profile
@greggles
greggles / gist:d4e208847671e0719568fef87ff2517e
Created November 7, 2024 16:08
gemini counting letters in strawberry
greggles@Gregs-MacBook-Pro ~/c/drupalorg (7.x-3.x)> python3 strawberry.py
The letter 's' appears 1 times.
The letter 't' appears 1 times.
The letter 'r' appears 3 times.
The letter 'a' appears 1 times.
The letter 'w' appears 1 times.
The letter 'b' appears 1 times.
The letter 'e' appears 1 times.
The letter 'y' appears 1 times.
@greggles
greggles / covid19apps.md
Last active November 10, 2020 18:23
Some information on covid19 apps in the USA 🇺🇸

List of Coronavirus Apps

  • State
  • App links with rating + number of reviews
  • Consulting provider, if known
  • Technologies (GPS, GAEN, TCN, etc.)
  • Date launched
  • Screenshots (followup)
  • What is their diagnosis key server?
```
ddev exec drush config-import -y --source=../config/default
+------------+--------------------------------------------------------------------------+-----------+
| Collection | Config | Operation |
+------------+--------------------------------------------------------------------------+-----------+
| | core.entity_form_display.paragraph.two_column_paragraph_group.default | Delete |
| | core.entity_view_display.paragraph.two_column_paragraph_group.default | Delete |
| | core.entity_form_display.paragraph.three_column_paragraph_group.default | Delete |
| | core.entity_view_display.paragraph.three_column_paragraph_group.default | Delete |
| | field.field.paragraph.three_column_paragraph_group.field_paragraph_group | Delete |
<?php
print "<pre>";
$urls = [
[
'url' => 'https://badssl.com/',
'expected_http' => 200,
'expected_curl_errno' => 0,
'expected_curl_error' => '',
sudo netstat -plunt | grep LISTEN | grep -v :: | awk -F/ '{print $1 " " $2}' | awk -F: '{print $2 " " $3}' | awk '{print $1 "\11" $6}' | sort -n
@greggles
greggles / php-7-probo.yaml
Created March 7, 2017 20:12
this probo.yaml snippet will install and configure php 7 for probo.ci
- name: Add php7
plugin: Script
script: |
echo 'exit 0' > /usr/sbin/policy-rc.d
apt-get update
apt-get install -y software-properties-common language-pack-en-base
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y php7.0 libapache2-mod-php7.0 php7.0-gd php7.0-curl php7.0-json php7.0-mbstring php7.0-mysql php7.0-mcrypt php7.0-imagick php7.0-dev php7.0-gmp php7.0-xml php7.0-bcmath php7.0-redis php7.0-uploadprogress php7.0-soap php7.0-pgsql
cp /etc/php5/mods-available/general_settings.ini /etc/php/7.0/apache2/conf.d/20-general_settings.ini
@greggles
greggles / gist:f6110e6a593109a7227c
Last active January 14, 2016 21:35
Mac: Check a ticket sales website every 30 seconds and when tickets go on sale, play a sound and open chrome to buy the tickets
# This url happens to be for a Tedeschi Trucks Band concert.
# You can go to any concert you want.
# But you *should* go to a Tedeschi Trucks Band concert at least once in your life.
watch -n 30 "curl -s https://events.applauze.com/events/3083244 | grep -i 'Coming Soon' || open -a Google\ Chrome https://events.applauze.com/events/3083244 ; say 'tickets are for sale' "
@greggles
greggles / gist:df1faa38ab27798e8e38
Last active November 12, 2015 18:37
Which database methods in Drupal are used most often?
# Grep for db_select and grab the next 5 lines
# grep and sed those lines to find db methods
# isolate the methods
# count them.
# I ran this in the core: modules/ directory, would be interesting to see results from a mix of sites/all/modules/ directories
➜ grep -hr -A 5 "db_select" . | grep "\->" | sed 's/^[ ]*//' | sed 's/\$[a-z]*//' | grep "^-" | awk -F\( '{print $1}' | sort | uniq -c | sort -rn
184 ->condition
168 ->fields
87 ->addField
70 ->execute
@greggles
greggles / find-drupal-files-by-where-they-are-being-used.php
Last active March 5, 2016 00:17
Finds Drupal files by name and lists out where they are being used (i.e. what nodes or users are associated with it)
<?php
// Save this, edit it and then...
// Run this with something like drush -v @sitename scr filename.php
// If a file is found and known to be in use, the use will be listed as an array of data.
// Edit the "card-1.xls" part.
$fid = db_query("SELECT fid FROM {file_managed} WHERE filename = 'card-1.xls'")->fetchField();
if ($fid) {
$file = file_load($fid);
@greggles
greggles / gist:dc14aba7222c2cece348
Created May 1, 2015 21:25
Find code style errors in modules in the subdirectory
find . -type d -d 1 -exec phpcs --standard=Drupal --extensions='php,module,inc,install,test,profile,theme,js,css,info,txt' --report-file={}_new.txt {} \;
# typical output:
# mani:contrib-patched greggles$ ls -lS *.txt
# -rw-r--r-- 1 greggles staff 10970 May 1 15:21 password_policy_style_issues.txt
# -rw-r--r-- 1 greggles staff 4887 May 1 15:21 code_coverage_style_issues.txt
# -rw-r--r-- 1 greggles staff 2681 May 1 15:21 quantcast_style_issues.txt
# mani:contrib-patched greggles$