Skip to content

Instantly share code, notes, and snippets.

Martin Mevald martinmev

Block or report user

Report or block martinmev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@martinmev
martinmev / Microsoft.PowerShell_profile.ps1
Last active May 25, 2019
PowerShell Core / Windows PowerShell - Workaround for non-US keyboard layout and Unicode code page
View Microsoft.PowerShell_profile.ps1
# Workaround for https://github.com/PowerShell/PSReadLine/pull/768
# Downgrade PS-Readline
# Install-Module -Name PSReadLine -RequiredVersion 1.2 -SkipPublisherCheck
# Install less pager
# https://www.guysalias.tk/misc/less/
# Unicode code page
chcp 65001
@martinmev
martinmev / email_export_from_Drupal_Simplenews.sql
Last active Jun 22, 2018
Intelligent mailing list (password protected) - it sends the email message to the list of the email addresses.
View email_export_from_Drupal_Simplenews.sql
------------ Email export from the Drupal Simplenews module
--- get Simplenews private key
select * from drupal_variable where name='simplenews_private_key';
-- +------------------------+------------------------------------------+
-- | name | value |
-- +------------------------+------------------------------------------+
-- | simplenews_private_key | s:32:"00000000000000000000000000000000"; |
@martinmev
martinmev / .xonshrc
Last active Jun 22, 2018
Xonsh: "c" - creates pretty part of the URL, "resizeDir" - resize and auto orient images in given directory
View .xonshrc
import unicodedata
def cData_(x):
s = unicodedata.normalize('NFKD', x).encode('ascii', 'ignore').lower().decode('ascii')
newS = ''.join(map(lambda x: x if x.isalnum() else '-', s))
oldS = None
while oldS != newS:
oldS = newS
newS = newS.replace('--', '-')
if newS:
@martinmev
martinmev / uc_gp.pages.inc.patch
Created Jan 14, 2018
Patch for Ubercart 6 Global Payments Webpay (GP) integration (Drupal 6; logging and digest1 checking)
View uc_gp.pages.inc.patch
diff --git a/www/sites/all/modules/uc_gp/uc_gp.pages.inc b/www/sites/all/modules/uc_gp/uc_gp.pages.inc
index 62b18da..2a1137f 100644
--- a/www/sites/all/modules/uc_gp/uc_gp.pages.inc
+++ b/www/sites/all/modules/uc_gp/uc_gp.pages.inc
@@ -41,6 +41,12 @@ function uc_gp_webpay_request($order) {
// Create full URL
$url = url($action, array('query' => $values));
+ $values_s = "";
+ foreach ($values as $key => $value) {
@martinmev
martinmev / drupal6_cache.patch
Created Oct 8, 2017
Patch for Drupal6 (and Pressflow6 too) cache
View drupal6_cache.patch
diff --git a/www/includes/cache.inc b/www/includes/cache.inc
index 1e70960..d08f3f4 100644
--- a/www/includes/cache.inc
+++ b/www/includes/cache.inc
@@ -17,9 +17,9 @@ function cache_get($cid, $table = 'cache') {
// Garbage collection necessary when enforcing a minimum cache lifetime
$cache_flush = variable_get('cache_flush_'. $table, 0);
- if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= time())) {
+ if ($cache_flush + variable_get('cache_lifetime', 0) <= time()) {
@martinmev
martinmev / .zshrc
Last active Oct 8, 2017
Drupal, Galleria field - mass image upload; Ubercart - add images to product. Python scripts create sql commands. Z Shell functions for easy use included.
View .zshrc
setopt extended_glob csh_null_glob
maintenance() {
echo "Maintenance mode."
cat <<EOF | mysql -u drupal -pPASSWORD drupal && echo "OK."
DELETE FROM variable WHERE name = 'site_offline';
INSERT INTO variable (name, value) VALUES ('site_offline', 's:1:"1";');
DELETE FROM cache WHERE cid = 'variables';
@martinmev
martinmev / gist:7741936
Last active Oct 8, 2017
Fix ugly file names (a simple shell function)
View gist:7741936
fix () {
for x in *
do
mv -- "$x" `echo "$x" | iconv -f utf8 -t ascii//TRANSLIT | tr '[:upper:]' '[:lower:]' | sed 's/[^-.a-zA-Z0-9]\+/-/g' | sed 's/[-]\+/-/g'` 2> /dev/null
done
}
fixDirs () {
fix
for x in *
@martinmev
martinmev / Readme.txt
Created Jan 9, 2017
Patch for Ubercart hidden checkout error
View Readme.txt
Patch for Ubercart hidden checkout error
Uc_cart version: 6.x-2.15
Drupal version: 6.38
Ubercart hidden checkout error:
No error message appeared when the database connection error occurred.
The drupal user wasn't created and the customer received only one email (below) with the account settings but the username was empty.
The order remained in the state "in checkout".
@martinmev
martinmev / gist:8248935
Last active Mar 27, 2016
Configuration: Postfix SMTP authentication and Dovecot SASL
View gist:8248935

Postfix SMTP authentication and Dovecot SASL

  • /etc/postfix/master.cf
  smtp      inet  n       -       -       -       -       smtpd
  submission inet n       -       -       -       -       smtpd
    -o smtpd_tls_security_level=encrypt
    -o smtpd_sasl_auth_enable=yes
@martinmev
martinmev / gist:2b219d7684b73692c96f
Last active Jan 29, 2016
Drupal HTML article: Delete the teaser image and display the first image (from Drupal Galleria module) in Lightbox (on click).
View gist:2b219d7684b73692c96f
<script type="text/javascript">
<!--
try { $('.Image')[0].outerHTML=''; } catch(err) {};
-->
</script></p>
<p><a href="#" onclick="Lightbox.start(
$('#galleria-content ul.galleria li a:eq(0)')[0]);
return false;"><img src="/sites/default/files/posli_to_dal2.jpg" style="float: left;"/></a></p>
You can’t perform that action at this time.