Skip to content

Instantly share code, notes, and snippets.

@m4k3r-org
m4k3r-org / encrypted-dvd.md
Created March 12, 2021 04:07 — forked from ansemjo/encrypted-dvd.md
create an encrypted dvd with squashfs and luks

1. Create compressed squashfs image

Use mksquashfs to create a compressed image from a directory. Depending on how compressible the files are you could put on much more than 4.7 GB on a single disc.

mksquashfs /path/to/my/directory image.sqfs

You can use a different compression algorithm with e.g. -comp zstd or append multiple times to one archive to fill it up to almost the allowable size.

2. Reencrypt the image to wrap it in a LUKS container

@m4k3r-org
m4k3r-org / mu-titkos.php
Last active November 9, 2019 01:38 — forked from WProbot/mu-titkos.php
WP mu plugin: csak a belépett felhasználók által látható tartalom.
<?php
// Az id = 123 poszt vagy oldal tartalmát
// csak belépett userek látják.
function fixv9_stop_guests($content) {
global $post;
if(1234 == $post->ID) {
if(!is_user_logged_in()) {
@m4k3r-org
m4k3r-org / upload-a-file.MD
Created November 7, 2019 17:26 — forked from ahmadawais/upload-a-file.MD
Upload a file using the WordPress REST API

Upload files

Using the REST API to upload a file to WordPress is quite simple. All you need is to send the file in a POST-Request to the wp/v2/media route.

There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle:

#!/bin/sh
libressl_version=libressl-2.5.1
libressl_archive=${libressl_version}.tar.gz
if [ -f ${libressl_archive} ]
then
:
else
wget -O ${libressl_archive} https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/${libressl_archive}
@m4k3r-org
m4k3r-org / ufw.md
Created September 26, 2019 15:09 — forked from kimus/ufw.md
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

@m4k3r-org
m4k3r-org / compile_nginx_from_sources.yml
Created September 19, 2019 21:24 — forked from dkorn/compile_nginx_from_sources.yml
Ansible Playbook compiling NGINX from sources, to include particular modules
---
- name: Compile NGINX from sources
hosts: webserver
vars:
nginx_version: nginx-1.13.4
nginx_tarball_url: "http://nginx.org/download/{{ nginx_version }}.tar.gz"
nginx_install_dir: "/tmp/{{ nginx_version }}"
nginx_sbin_path: "/usr/sbin/nginx"
nginx_conf_path: "/etc/nginx/nginx.conf"
@m4k3r-org
m4k3r-org / nginx.conf
Created September 19, 2019 07:15 — forked from v0lkan/nginx.conf
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@m4k3r-org
m4k3r-org / lampa-1.c
Created January 29, 2019 10:00
Egyszerű állapotgép demonstráció
/*
*
* Egyszerű állapotgép demonstráció
*
* [email protected]
*/
/* ---------------------------------------------------- */
#include <stdio.h>
@m4k3r-org
m4k3r-org / cache.phpi
Created September 28, 2018 02:23 — forked from CAFxX/cache.phpi
PHP remote file/URL cache
<?php
/*
A simple cache for remote files/URLs
2011 Carlo Alberto Ferraris <[email protected]>
===================================================
The cache function allows you to get the contents of a remote URL at
most once every N seconds. It also supports the If-Modified-Since HTTP
header to avoid fetching the resource again if it hasn't changed.
@m4k3r-org
m4k3r-org / functions.php
Created September 22, 2018 21:39
Allowing user to edit only certain pages
function my_pre_get_posts($query) {
screen = get_current_screen();
current_user = wp_get_current_user();
$restricted_user_id = 10;
$allowed_post_id = 1234;
$current_post_id = isset($_GET['post'])?(int)$_GET['post']:false;