Skip to content

Instantly share code, notes, and snippets.

@YogSottot
YogSottot / Colemak-DH-mod_dvorak_programmer.kbd.json
Last active August 8, 2016 13:38
Colemak-DH-mod+dvorak_programmer
[
{
"backcolor": "#ffffff",
"name": "Colemak-DH-mod+dvorak_programmer"
},
[
"Esc",
{
"x": 1
},
@YogSottot
YogSottot / fix_database_to_utf8.py
Last active May 25, 2018 12:10 — forked from ibnIrshad/fix_database_to_utf8.py
Small python script that converts character sets to utf8 in all databases and tables. My solution for "Illegal mix of collations" errors. (http://stackoverflow.com/questions/3029321/how-to-solve-illegal-mix-of-collations-in-mysql)
from MySQLdb import connect
conn = connect(user="[user]", passwd= "[password]", host="[host]")
cur = conn.cursor()
cur.execute("show databases;")
dbs_to_update = filter(
lambda db: db not in ('information_schema', 'mysql', 'performance_schema'),
[dbname[0] for dbname in cur.fetchall()])
@YogSottot
YogSottot / Postfix: sender-dependent SASL authentication.md
Created April 20, 2018 08:44 — forked from zmwangx/Postfix: sender-dependent SASL authentication.md
Postfix: sender-dependent SASL authentication — relay to multiple SMTP hosts, or relay to the same host but authenticate as different users (e.g., two Gmail accounts)

This is a sequel to "Postfix: relay to authenticated SMTP".

I would like to send mail from two different Gmail accounts using Postfix. Here is the relevant section in the Postfix documentation: Configuring Sender-Dependent SASL authentication.

As a concrete example, here's how to set up two Gmail accounts (only relevant sections of the config files are listed below):

/etc/postfix/main.cf:
    # sender-dependent sasl authentication
    smtp_sender_dependent_authentication = yes

sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay

@YogSottot
YogSottot / mysql-convert-charset.sh
Created May 25, 2018 12:03 — forked from samuelpismel/mysql-convert-charset.sh
Shell script to change and convert mysql databases charset and collate.
#!/bin/bash
database='database'
user='user'
pass='pass'
charset='utf8mb4'
collate='utf8mb4_unicode_ci'
echo "Changing charset of database: $database"
@YogSottot
YogSottot / install-comodo-ssl-cert-for-nginx.rst
Last active January 30, 2020 14:08 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@YogSottot
YogSottot / nginx.conf
Created August 17, 2018 11:14 — forked from jrom/nginx.conf
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@YogSottot
YogSottot / linuxprivchecker.py
Created August 30, 2018 14:57 — forked from YazooSecurity/linuxprivchecker.py
linuxprivchecker.py -- a Linux Privilege Escalation Check Script
#!/usr/env python
###############################################################################################################
## [Title]: linuxprivchecker.py -- a Linux Privilege Escalation Check Script
## [Author]: Mike Czumak (T_v3rn1x) -- @SecuritySift
##-------------------------------------------------------------------------------------------------------------
## [Details]:
## This script is intended to be executed locally on a Linux box to enumerate basic system info and
## search for common privilege escalation vectors such as world writable files, misconfigurations, clear-text
## passwords and applicable exploits.
@YogSottot
YogSottot / init.php
Last active November 1, 2019 12:42 — forked from muxx/init.php
pinba configure in Bitrix
<?php
include __DIR__ . '/pinba_configure.php';
@YogSottot
YogSottot / P12toPEM.txt
Last active February 12, 2020 12:24 — forked from shahdhiren/P12toPEM.txt
Convert P12 file for Push Notification to PEM format
Development Phase:
Step 1: Create Certificate .pem from Certificate .p12
Command: openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12
Step 2: Create Key .pem from Key .p12
Command : openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12
Step 3: Optional (If you want to remove pass phrase asked in second step)
Command : openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem
@YogSottot
YogSottot / gist:ed011f7f65d6d95848dc2e83c908cfae
Last active December 19, 2020 14:39 — forked from splacento-incomm/gist:a2895551d36f66b3e715286ae232767a
Find all system files in mysql db FTS issue
magento2 db server was crashing and we had to investigate why.
Long story short: it ran out of space. 220GB ssd with 0 bytes free.
Mysql folder size 70GB while db itself is somewhere near 300MB.
So most of space was used by:
FTS_0000000000274d82_000000000031bd04_INDEX_1.ibd
FTS_0000000000274d82_000000000031bd04_INDEX_2.ibd
FTS_0000000000274d82_000000000031bd04_INDEX_3.ibd
FTS_0000000000274d82_000000000031bd04_INDEX_4.ibd
FTS_0000000000274d82_000000000031bd04_INDEX_5.ibd
FTS_0000000000274d82_000000000031bd04_INDEX_6.ibd