Skip to content

Instantly share code, notes, and snippets.

View rmontagud's full-sized avatar

Rafael Montagud rmontagud

View GitHub Profile
@rvalitov
rvalitov / jailkit-php-config.md
Created June 24, 2023 08:00
Configuration of jailkit for PHP and ISPConfig

Jailkit configuration

Jailkit is used to create a secure shell environment for the user. It's also used by ISPConfig to securely run user's cron jobs from command line. Default jailkit configuration may not properly support PHP. So, first jailkit needs to be installed:

$ sudo apt-get install jailkit

Then configuration file /etc/jailkit/jk_init.ini needs to be modified by addding 2 new sections - php and env:

@fideloper
fideloper / microsoft_graph_api_php_jwt.md
Last active February 19, 2024 18:09
Microsoft Graph API - oAuth apps with PHP and JWT certification authentication

Microsoft Graph API - oAuth apps with PHP and JWT certification authentication

If you've ever wanted to create an oAuth style application with Microsoft, you might have felt this pain before.

In true Enterprise Microsoft Fashion™, there's a lot going on.

This will be a bit long because of that. I hope I haven't missed anything (but I'm sure I have)!

We'll be using PHP (Laravel in my case).

@Naroh091
Naroh091 / bancos-espana-codigo-nombre-bic.csv
Last active November 16, 2021 09:49
Bancos de España. Relación entre el código de cuenta (4 dígitos), el nombre y el BIC. Actualizado a octubre de 2021.
id codigo nombre bic
1 0003 BANCO-DEPOSITOS BDEPESM1
2 0011 ALLFUNDS-BANK ALLFESMM
3 0019 DEUTSCHE-BANK DEUTESBB
4 0031 BANCO-ETCHEVARRIA ETCHES2G
5 0036 SANTANDER-IVESTMENT SABNESMM
6 0038 SANTANDER-BANCO-EMISIONES BSCHESMM
7 0046 BANCO-GALLEGO GALEES2G
8 0049 BANCO-SANTANDER BSCHESMM
9 0057 BANCO-DEPOSITARIO-BBVA BVADESMM
@eusonlito
eusonlito / drop-column-if-exists.sql
Last active March 14, 2023 18:35
Drop table column only if exists in a MySQL database
DROP PROCEDURE IF EXISTS `DropColumnIfExists`;
DELIMITER $$
CREATE PROCEDURE `DropColumnIfExists` (`@TABLE` VARCHAR(100), `@COLUMN` VARCHAR(100))
`DropColumnIfExists`: BEGIN
DECLARE `@EXISTS` INT UNSIGNED DEFAULT 0;
SELECT COUNT(*) INTO `@EXISTS`
FROM `information_schema`.`columns`
@ThomasLeister
ThomasLeister / rspamd-whitelisting.md
Last active May 9, 2024 10:49
How to whitelist IP addresses or domains in Rspamd

Whitelist IP addresses based on pre-filter policy

/etc/rspamd/local.d/multimap.conf:

  IP_WHITELIST {
      type = "ip";
      prefilter = true;
      map = "/${LOCAL_CONFDIR}/local.d/ip_whitelist.map";
 action = "accept";
@itbdw
itbdw / ip_whitelist.lua
Last active April 2, 2024 10:43 — forked from Ceelog/cloudSettings
Nginx Lua IP Whitelist Rule
-- a quick LUA access script for nginx to check IP addresses match an
-- `ip_whitelist` set in Redis, and if no match is found send a HTTP
-- 403 response or just a custom json instead.
--
-- allows for a common whitelist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- white an ip:
-- redis-cli SADD ip_whitelist 10.1.1.1
@lkmadushan
lkmadushan / nginx.conf
Last active May 1, 2021 01:29
NGINX configuration for multi-tenant PHP application
map $http_accept $api_version {
default 0;
"application/vnd.example.v1+json" 1;
}
server {
listen 80;
listen [::]:80;
@aromig
aromig / robocopy_exclude_existing_files.cmd
Created September 28, 2016 14:47
Robocopy - Exclude Existing Files
robocopy c:\Sourcepath c:\Destpath /E /XC /XN /XO
:: /E makes Robocopy recursively copy subdirectories, including empty ones.
:: /XC excludes existing files with the same timestamp, but different file sizes. Robocopy normally overwrites those.
:: /XN excludes existing files newer than the copy in the source directory. Robocopy normally overwrites those.
:: /XO excludes existing files older than the copy in the source directory. Robocopy normally overwrites those.
:: With the Changed, Older, and Newer classes excluded, Robocopy will exclude files existing in the destination directory.
@allella
allella / gist:ffdcf0a5dd9e147405b5
Last active May 8, 2017 13:59
Let's Encrypt .htaccess to Fix Issues with Drupal or Wordpress Getting "cannot connect" Error
# add this before all other rewrite rules in your .htaccess
# backup your Apache file(s) first to avoid breaking things
# BE SURE TO TEST AND RELOAD APACHE AFTER MAKING THIS EDIT
# allow Let's Encrypt to access it's challenge file without the rewrite rules screwing them up
RewriteEngine On
RewriteRule "^.well-known/acme-challenge" - [L]
# Now, run an error check and reload Apache
/usr/sbin/apachectl configtest && /etc/init.d/httpd reload
@magnetikonline
magnetikonline / README.md
Last active June 18, 2024 05:43
BIND - delegate a sub domain for a zone.

BIND - delegate a sub domain for a zone

The scenario:

  • DNS zone myzone.com defined in BIND.
  • Authoritative name server at 123.16.123.1.
  • Subzone sub.myzone.com with an authoritative name server at 123.16.123.10.
  • Wishing to forward sub-zone to authoritative name server.

Config