Skip to content

Instantly share code, notes, and snippets.

@jinta4020
jinta4020 / Debian11-WinterBoot-Docker-Rootless
Last active March 22, 2023 07:34
Add Rootless Docker in Debian 11.
#!/bin/bash
# Author: Jinta Orishima
set -eu
script_name="Debian 11 Winter Boot Docker Rootless"
compose_v="2.6.0"
echo "Running ${script_name}..."
@vijinho
vijinho / markdown_escape.php
Last active February 26, 2024 14:28
Escape markdown in php
<?php
/**
* Escape markdown text
*
* @param string $text the markdown text to escape
*
* @return string escaped text
*/
function markdown_escape($text) {
return str_replace([
@kagg-design
kagg-design / gist:7cbda38a3ce76c0502748f8ddbc9bebe
Created September 5, 2019 07:00
Remove current action or filter from plugin
<?php
/**
* Remove current action or filter from plugin
*
* @param string $class_name Class name enqueueing the action.
* @param null $action_name Action name.
*/
function remove_plugin_action( $class_name, $action_name = null ) {
global $wp_filter;
<?php
/**
* Загружает изображение в медиабиблиотеку по переданному url.
*
* @param string $url
* @param int $post_id
*
* @return int|WP_Error
*/
@kagg-design
kagg-design / class-downloader.php
Last active May 18, 2022 16:41
A class to hide downloadable links and count downloads.
<?php
/**
* Class to hide file download links and count download number.
*
* @package kagg-downloader
*/
namespace GTS\Quote;
/**
@devdrops
devdrops / example.md
Last active March 25, 2024 15:09
Mysqldump from Docker container

Mysqldump from Docker container

docker exec -i mysql_container mysqldump -uroot -proot --databases database_name --skip-comments > /path/to/my/dump.sql

OBS

  • This will generate a dump.sql file in your host machine. Awesome, eh?
  • Avoid using --compact on your dump. This will make MySQL check your constraints which will cause troubles when reading your file (damm you MySQL). And don't use --force to fix this scenario: recreate your dump without --compact ¯_(ツ)_/¯
@floudet
floudet / ssh-chroot-jail.sh
Created June 19, 2016 11:57
Chroot Jail for SSH Access
# Chroot Jail for SSH Access
# Tested on Ubuntu 14.04.2 LTS and Debian GNU/Linux 8 (jessie)
# Reference : http://allanfeid.com/content/creating-chroot-jail-ssh-access
#
# Had to add/change several things to make it work, including:
# - create lib64 folder
# - copy whoami dependencies that ldd doesn't show to fix 'I have no name!'
# in the customized prompt + create passwd file
#
@alces
alces / ansible_local_playbooks.md
Last active June 13, 2024 02:02
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
@plepe
plepe / gist:52ecc9f18efb32c68d18
Last active June 6, 2024 22:23
MDADM and LVM cheat sheet

mdadm

Glossary:

  • md: multiple devices
command description
cat /proc/mdstat show status of all raids
mdadm --detail /dev/md0 detailed status of raid md0