Skip to content

Instantly share code, notes, and snippets.

@andkirby
andkirby / slack.sh
Last active April 4, 2024 17:51
Shell/Bash script for sending slack messages.
#!/usr/bin/env bash
####################################################################################
# Slack Bash console script for sending messages.
####################################################################################
# Installation
# $ curl -s https://gist.githubusercontent.com/andkirby/67a774513215d7ba06384186dd441d9e/raw --output /usr/bin/slack
# $ chmod +x /usr/bin/slack
####################################################################################
# USAGE
# Send message to slack channel/user
@julienbourdeau
julienbourdeau / clean-prestashop-db.sql
Last active March 20, 2024 13:06
Clean PrestaShop database - Drop old and unless data
# Delete all logs
TRUNCATE ps_log;
# Delete old connection data (only used for stats)
# change 2016-02-01 00:00:00 according to you needs
DELETE c, cs
FROM ps_connections c
LEFT JOIN ps_connections_source cs ON (c.id_connections = cs.id_connections)
WHERE c.date_add < '2016-02-01 00:00:00';
@insignia96
insignia96 / changepassword.php
Last active March 17, 2024 00:26 — forked from mattrude/changepassword.php
LDAP PHP Change Password Page (modified for Active Directory)
<?php
/**
* LDAP PHP Change Password Webpage (modified for Active Directory)
* @author: Matt Rude <http://mattrude.com>
* @author: Isaiah Olson <http://www.olsontech.io/>
* @website: http://technology.mattrude.com/2010/11/ldap-php-change-password-webpage/
*
*
* GNU GENERAL PUBLIC LICENSE
@scottsweb
scottsweb / gravity-forms-validation.php
Last active March 11, 2024 10:22
Using a Gravity Forms filter to create a custom validation and check for existing UID in already saved entries.
<?php
/***************************************************************
* Function media_custom_validation
* Check the media form for duplicate inputs on the same day
***************************************************************/
add_filter('gform_validation', 'media_custom_validation');
function media_custom_validation($validation_result) {
@Lathanao
Lathanao / my.cnf
Last active January 10, 2024 15:54
Percona Server 8.0 configuration file
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
@tjelen
tjelen / zerotier-ubuntu-gateway.md
Last active December 29, 2023 13:34
Zerotier: Setting up the default gateway in Ubuntu Linux

Zerotier Ubuntu config notes

Setting up the default gateway (for VPN tunelling)

Ubuntu 18.04 UFW settings, based on [1] Step 1

  • ens3 .. primary physical ETH interface
  • 10.243.0.0/16 .. ZT network
@jerome-labidurie
jerome-labidurie / index.html
Created October 17, 2015 14:01
Synology SSO server login example
<html>
<head>
<!-- include Synology SSO js -->
<script src="http://ds:5000/webman/sso/synoSSO-1.0.0.js"></script>
</head>
<body>
<script>
/** Display login/logout button.
@taeo
taeo / gravityforms-star-ratings.html
Last active November 8, 2022 15:18
Quick hack / jQuery plugin to enable visual star ratings from Gravity Forms radio fields.
<!--
GRAVIY FORMS NOTES:
1. Create a “radio” group on any form
2. In the “appearance" tab, give the custom css class `js-gf-rating-stars`
3. The radio values should be in order from low -> high (1,2,3,4,5,etc…).
4. You can have as many stars as you want, it’s based off the number of radio elements in the group.
5. You could technically have as many groups of ratings stars as you want.
JS CONFIG:
@levymetal
levymetal / directions.js
Last active November 1, 2022 02:38
Tutorial on how to calculate driving distance using Google maps API, full post available @ http://christianvarga.com/how-to-calculate-driving-distance-between-2-locations-with-google-maps-api/
var directionsService = new google.maps.DirectionsService();
var request = {
origin : 'Melbourne VIC', // a city, full address, landmark etc
destination : 'Sydney NSW',
travelMode : google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if ( status == google.maps.DirectionsStatus.OK ) {
@franz-josef-kaiser
franz-josef-kaiser / ajax.js
Last active May 31, 2022 15:53
AJAX in WordPress. Class based example.
( function( $, plugin ) {
"use strict";
// Working with promises to bubble event later than core.
$.when( someObjectWithEvents ).done( function() {
console.log( 'AJAX request done.' );
} )
.then( function() {
setTimeout( function() {
console.log( 'AJAX requests resolved.' );