Skip to content

Instantly share code, notes, and snippets.

@davidalger
davidalger / install-php-sodium-on-el8.md
Created December 2, 2019 17:50
Install php-sodium on EL 8

There is currently no pre-built package available for the php sodium ext currently. And due to the changes made to the EL 8 packaging system, IUS no longer plans to maintain any packages for EL 8 (alternate versions of packages such as PHP should eventually become available via additional module streams published in the AppStream repo) so it's not available via IUS either beyond EL 7.

Magento will fallback on sha256 for password hashes when sodium is unavailable:

public function getLatestHashVersion(): int
{
    if (extension_loaded('sodium') && defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13')) {
        return self::HASH_VERSION_ARGON2ID13;
    }

return self::HASH_VERSION_SHA256;

@geoghegan
geoghegan / weather.sh
Created August 15, 2018 09:52
Command line weather
###
# Shows your local weather using curl
# Defaults to Dublin, Ireland (DUB) if the Weather server cannot determine your location
# instead of Oymyakon, Russia (coldest place on earth)
###
LOCAL_WEATHER=$(curl -s -N http://wttr.in/?m | head -n 7 | grep "Weather report: Oymyakon, Russia")
if [[ $LOCAL_WEATHER == 'Weather report: Oymyakon, Russia' ]]
then
@yesnik
yesnik / active_record.md
Last active November 23, 2023 19:51
Yii 1 Framework Cookbook

CActiveRecord methods

findAll()

Sort records

// Ascending order
Partner::model()->findAll(array('order' => 'company'));
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active April 23, 2024 03:11
Hyperlinks in Terminal Emulators
@micw
micw / install_jenkins_plugin.sh
Last active August 11, 2023 06:14
Script to install one or more jenkins plugins including dependencies while jenkins is offline
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
echo "USAGE: $0 plugin1 plugin2 ..."
exit 1
fi
plugin_dir=/var/lib/jenkins/plugins
@mathewbyrne
mathewbyrne / CsvResponse.php
Created March 21, 2013 22:54
A small Symfony 2 class for returning a response as a CSV file. Based on the Symfony JsonResponse class.
<?php
namespace Jb\AdminBundle\Http;
use Symfony\Component\HttpFoundation\Response;
class CsvResponse extends Response
{
protected $data;
@kgaughan
kgaughan / scrub-html-whitespace.sh
Last active October 12, 2015 18:58
Cleans up basic whitespace problems in .rst and .py files. Run before commits.
#!/bin/bash
#
# Cleans up basic whitespace problems in .html files. Run before commits.
#
# Spaces to tabs.
for i in `find . -name \*.html`; do
if test -f $i; then
tmp=`mktemp`
unexpand -t4 --first-only $i >$tmp
@jackkinsella
jackkinsella / blueprint_to_bootstrap.sh
Created July 25, 2012 14:39
Convert Blueprint to Twitter Bootstrap Span Classes - one-liner
# Commit before using this script since it changes your files permanently.
# Run from your web app's root folder.
ack -l "span-[0-9][0-9]?" | xargs sed -i "" -E 's/span-([0-9]{1,2})/span\1/'
@JamieMason
JamieMason / gist:3152574
Created July 20, 2012 18:57
.bash_profile
# PATH ADDITIONS
export PATH="~/bin:$PATH"
# GIT CREDENTIALS
GIT_AUTHOR_NAME="You"
GIT_AUTHOR_EMAIL="you@yours.com"
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
git config --global user.name "$GIT_AUTHOR_NAME"
git config --global user.email "$GIT_AUTHOR_EMAIL"
@samdark
samdark / yii_functions_sql.php
Created June 21, 2012 19:33
Yii: handy functions to use Yii with raw SQL
<?php
/**
* Escapes values
*
* @param array $values array of values to escape
* @return string string ready to be included into SQL statement
* @throws CException if one of the values isn't a scalar
*/
function escape($values)
{