Skip to content

Instantly share code, notes, and snippets.

@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"
@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

@Zenexer
Zenexer / escapeshellrce.md
Last active November 2, 2023 06:09
Security Advisory: PHP's escapeshellcmd and escapeshellarg are insecure

Paul Buonopane paul@namepros.com at NamePros
PGP: https://keybase.io/zenexer

I'm working on cleaning up this advisory so that it's more informative at a glance. Suggestions are welcome.

This advisory addresses the underlying PHP vulnerabilities behind Dawid Golunski's [CVE-2016-10033][CVE-2016-10033], [CVE-2016-10045][CVE-2016-10045], and [CVE-2016-10074][CVE-2016-10074]. It assumes prior understanding of these vulnerabilities.

This advisory does not yet have associated CVE identifiers.

Summary

@kekru
kekru / Docker connect to remote server.md
Last active April 15, 2024 16:26
Connect to another host with your docker client, without modifying your local Docker installation

Run commands on remote Docker host

This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.

Enable Docker Remote API

First be sure to enable the Docker Remote API on the remote host.

This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.

@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;
@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=' '
@parmentf
parmentf / GitCommitEmoji.md
Last active April 18, 2024 19:01
Git Commit message Emoji
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@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
@mrverrall
mrverrall / rhel7-moodle.sh
Last active February 1, 2024 15:00
A script that installs and configures all the core components for moodle on RHEL/Centos 7 leaving you with a running site complete with AV scanning and Memcached
#!/bin/bash
#
# This Bash script installs Moodle (http://moodle.org) and all it's
# requirements into a freshly installed Centos or RHEL 7 operating system.
# It assumes an 'Enforced' SELinux environment and configures the system
# accordingly.
#
# It is designed to be instructional and clear to read to persons unfamiliar
# with Bash and as such does *no* sanity checking before taking actions.
# Becasue of this *great* care should be taken if you feel the urge to run