Skip to content

Instantly share code, notes, and snippets.

View sanmai's full-sized avatar

Alexey Kopytko sanmai

View GitHub Profile
@mrkhoa99
mrkhoa99 / GMO Payment Gateway Magento 2
Created July 19, 2016 10:48
The API does not return error messages, so I translated these from the example english-like messages in the GMO documentation
#Resource reference: https://docs.omniref.com/github/veracross/active_merchant/HEAD/symbols/ActiveMerchant::Billing::GmoGateway#line=46
# The API does not return error messages, so I translated these from the
# example english-like messages in the GMO documentation
ERROR_CODES = {
'E01010001' => 'Shop ID not specified',
'E01010008' => 'Shop ID contains invalid characters or is too long',
'E01010010' => 'Shop ID is invalid',
'E01020001' => 'Shop Password not specified',
'E01020008' => 'Shop Password contains invalid characters or is too long',
'E01030002' => 'Shop ID and Password are invalid',
@alces
alces / ansible_local_playbooks.md
Last active June 5, 2024 17:36
How to run an Ansible playbook locally
  • using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
  • using inventory:
127.0.0.1 ansible_connection=local
@bmhatfield
bmhatfield / .profile
Last active May 6, 2024 22:27
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
anonymous
anonymous / howto.md
Created March 12, 2016 02:56
Если у вас есть красивый домен, от которого вы хотите отказаться...
  1. Получаем бесплатный SSL сертификат для этого домена:
  1. Настраиваем этот домен в nginx с указанием HSTS заголовка:
add_header Strict-Transport-Security "max-age=10886400; includeSubDomains; preload";
  1. Добавляем его в HSTS preload list.
@kleptog
kleptog / cantenna.md
Last active October 5, 2023 10:14
Cantenna mathematics
@meddulla
meddulla / How-to-git-diff-gettext-binary-mo-files.txt
Last active March 25, 2021 11:23
How to git diff gettext binary mo files
In .gitattributes (alongside .gitignore in top repo dir) add:
*.mo diff=mo2po
In .git/config add (msgunfmt converts an mo to a po file):
[diff "mo2po"]
textconv = msgunfmt
More info at https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#Binary-Files
@matthewmueller
matthewmueller / osx-for-hackers.sh
Last active April 21, 2024 03:30
OSX for Hackers (Mavericks/Yosemite)
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
@sivel
sivel / better-ssh-authorized-keys-management.md
Last active May 3, 2024 14:20
Better SSH Authorized Keys Management

Better SSH Authorized Keys Management

A seemingly common problem that people encounter is how to handle all of your users authorized_keys file.

People struggle over management, ensuring that users only have specific keys in the authorized_keys file or even a method for expiring keys. A centralized key management system could help provide all of this functionality with a little scripting.

One piece of functionality overlooked in OpenSSH is the AuthorizedKeysCommand configuration keyword. This configuration allows you to specify a command that will run during login to retrieve a users public key file from a remote source and perform validation just as if the authorized_keys file was local.

Here is an example directory structure for a set of users with SSH public keys that can be shared out via a web server:

@staltz
staltz / introrx.md
Last active June 7, 2024 23:39
The introduction to Reactive Programming you've been missing
@dschneider
dschneider / convert_utf8_to_utf8mb4
Created May 7, 2014 14:44
How to easily convert utf8 tables to utf8mb4 in MySQL 5.5
# For each database:
ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
# For each table:
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# For each column:
ALTER TABLE table_name CHANGE column_name column_name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# (Don’t blindly copy-paste this! The exact statement depends on the column type, maximum length, and other properties. The above line is just an example for a `VARCHAR` column.)