Skip to content

Instantly share code, notes, and snippets.

View mig5's full-sized avatar

mig5

View GitHub Profile
@malclocke
malclocke / adminpass.drush.inc
Created August 18, 2010 01:07
A drush command to reset a Drupal site admin password, either permanently or temporarily
<?php
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@typhonius
typhonius / cacheplotter.drush.inc
Created April 30, 2014 09:51
I feel dirty putting the Drupal 6.x integration in there but it's still a supported API version so w/e. This checks your db cache tables for sizes of values. Useful if you're using memcache and are worried about exceeding the max page size.
<?php
/**
* @file
* Drush command to check for overly large items in DB cache tables that will
* not work with memcache.
*/
/**
* Implements hook_drush_command().
@morhekil
morhekil / nginx.conf
Created August 14, 2014 12:18
Full request/response body logging in nginx
http {
log_format bodylog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time '
'<"$request_body" >"$resp_body"';
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@QuentinBrosse
QuentinBrosse / image-id-by-label.md
Last active August 9, 2021 12:24
Find Scaleway Image ID by Label

Find Scaleway Image ID by Label

It could be difficult to find a Scaleway image ID for the right zone, architecture, and instance type. The Scaleway marketplace API has an endpoint dedicated to that but it could be difficult to understand the response and to find the right image UUID.

Here is a bash command that returns a JSON with just the necessary information needed to find your image ID.

curl -s 'https://api-marketplace.scaleway.com/images?page=1&per_page=100' | sed 's/par1/fr-par-1/g; s/ams1/nl-ams-1/g' | jq '.images | map({"key": .label | gsub("_";"-"), "value": .versions[0].local_images}) | from_entries'