Skip to content

Instantly share code, notes, and snippets.

@duggan
duggan / check.php
Last active July 24, 2017 07:16
Get latest versions of a list of PHP PECL extensions
<?php
/*
* Usage:
* $ php check.php --extensions="apc memcached redis"
* apc: 3.1.13
* memcached: 2.2.0
* redis: 2.2.5
*/
class PHPExtensionUpdates {
@vgrichina
vgrichina / SQLServerDialect.java
Created November 3, 2009 22:51
Improved MSSQL dialect for Hibernate (using more appropriate data types)
/*
* Copyright © 2009, Componentix. All rights reserved.
*/
package com.componentix.hibernate.dialect;
import java.sql.Types;
/**
* A proper dialect for Microsoft SQL Server 2000 and 2005.
#!/bin/bash
################################
#!# SiteId=behat_whole_suite_m
#!# OutputFormat=moodle_progress,junit
################################
# Optional Params.
if [ -z "${BehatProfileToUseOnDay}" ]; then
BehatProfileToUseOnDay="default default default default default default default"
fi
if [ -z "${SELENIUMPORT}" ]; then
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.hibernate.dialect;
import java.sql.Types;
import java.sql.Types;
import org.hibernate.Hibernate;
@jraleman
jraleman / git-change-author.sh
Last active October 12, 2020 16:54
Script to change git commits' author
#!/bin/sh
# Usage message if number of arguments are invalid.
if [ "$#" -ne 3 ] ; then
echo "usage: sh $0 wrong-email new-email new-name"
exit 1
fi
# Save args to variables.
WRONG_EMAIL="$1"
@stronk7
stronk7 / pre-push
Last active December 20, 2020 23:18
pre-push hook to avoid Moodle upstream branches to perform travis/github actions builds all the time
#!/bin/bash
# pre-push hook to enable/disable travis and github actions push builds
# based on the nature of the pushed branches.
# - upstream and deleted ones won't be built.
# - development ones will be built.
# Requires travis (client) gem binary installed.
# Requires gh (client) binary installed.
# Useful for people wanting to keep their upstream branches updated,
# and not causing them to perform travis/github actions builds all the time, like me :-)
IFS=' '
@himanshuvirmani
himanshuvirmani / DatabaseConfiguration.java
Created September 26, 2016 11:59
SpringBoot Multiple DB Connections using Routing DataSource
@Configuration
@EnableJpaAuditing(dateTimeProviderRef = "dateTimeProvider")
@EnableJpaRepositories("com.sample.repository")
@EnableTransactionManagement
public class DatabaseConfiguration implements EnvironmentAware {
private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class);
private RelaxedPropertyResolver dataSourcePropertyResolver;
private RelaxedPropertyResolver slaveDataSourcePropertyResolver;
@nestoru
nestoru / Solution for mysql Warning: Using a password on the command line interface can be insecure
Last active October 23, 2021 21:20
Solution for mysql Warning: Using a password on the command line interface can be insecure
# Let us consider the following typical mysql backup script:
mysqldump --routines --no-data -h $mysqlHost -P $mysqlPort -u $mysqlUser -p$mysqlPassword $database
# It succeeds but stderr will get:
# Warning: Using a password on the command line interface can be insecure.
# You can fix this with the below hack:
credentialsFile=/mysql-credentials.cnf
echo "[client]" > $credentialsFile
echo "user=$mysqlUser" >> $credentialsFile
echo "password=$mysqlPassword" >> $credentialsFile
@sergiotabanelli
sergiotabanelli / REVAMPED.md
Last active March 26, 2022 17:55
MYSQLND_MS REVAMPED: Single and multi-master read/write consistency enforcing in MySQL asynchronous clusters with PHP and mysqlnd_ms extension

MYSQLND_MS REVAMPED: Single and multi-master read/write consistency enforcing in MySQL asynchronous clusters with PHP and mysqlnd_ms extension

NOTE: The service level and consistency feature is one of the most changed areas of the mymysqlnd_ms fork. Functionalities like server side read consistency and server side write consistency allow transparent migration to MySQL asyncronous clusters in almost all use cases with no or at most extremely small effort and application changes.

Different types of MySQL cluster solutions offer different service and data consistency levels to their users. Any asynchronous MySQL replication cluster offers eventual consistency by default. A read executed on an asynchronous slave may return current, stale or no data at all, depending

@danpoltawski
danpoltawski / simplified_behat_for_tim_hunt.md
Last active March 22, 2023 17:20
Simplified behat for Tim Hunt

Simplified behat for Tim Hunt.

Disclaimers:

  • I'm hoping this will help you understand so you can help us improve our documentation.
  • This is simplified version, i'm ignoring some details which are unimportant for discusing this.

What Behat requires.