Skip to content

Instantly share code, notes, and snippets.

@msenturk
msenturk / recaptcha-exchange-2016.md
Last active March 19, 2024 13:08
recaptcha-exchange-2016.md

Integrate reCAPTCHA Validation to Exchange 2016 Outlook - OWA

We need to create an XMLHTTPRequest requester (using JavaScript) to POST the user input to Google. The first problem I encountered was that XMLHTTPRequest refuses to POST data to a different site other than the one you’ve loaded the current page from. This, apparently, is thanks to a security policy called the Same Origin Policy. This means we need to create an additional page on our own server to act as a proxy, and do the POSTing for us. This extra page returns a success or fail code to the FBA page, telling it whether to proceed with the logon, or not. It turns out that this has the added benefit of us not having to put our private key in the source for the FBA page (which would make it no longer really private).

  • Get a Public key and a Private key for your web site here.
@xarmengol
xarmengol / 20201021-xarmengol-moving-folders-older-than.md
Last active February 1, 2022 15:08
Moving files older than 1 year

Moving folders older than one year from current location, to destination folder:

find . -maxdepth 1 -mtime +365 -exec sudo mv {} /mnt/DestinationFolder/ \;

  • -maxdepth 1 option is to only check folders age at first level
  • -mtime +365 to list files or folder older than or equal to 365 days old
@xarmengol
xarmengol / 20200403-xarmengol-increase_disk_partition_centos8.md
Last active April 17, 2023 13:51
How to increase partition disk on vmware CentOS 8

Steps to increase the disk for a vmware centos 8 server

1. Increase the virtual machine disk by using vCenter

Increase the disk space of the machine, using vCenter. If there is any existing snapshot, this could not be done. So any existing snapshot have to be deleted previously.

Not sure if needed, but once the disk space is increased, reboot the machine.

2. Create a new partition disk by using fdisk

@dmhendricks
dmhendricks / wordpress-remove-script-versions-plugin.php
Last active November 13, 2022 10:56
A simple WordPress plugin to remove the script version from linked CSS and JS scripts to improve cacheability.
<?php
/**
* @wordpress-plugin
* Plugin Name: Remove Script Versions
* Description: Removes the script version from linked CSS and JS scripts to improve cacheability.
* Plugin URI: https://gist.github.com/dmhendricks/fbf4c69b3c7a13ffa04526427083742a/
* Version: 1.0.0
* Author: Daniel M. Hendricks
* Author URI: https://daniel.hn/
* License: GPLv2 or later
@valferon
valferon / postgres_manager.py
Created March 29, 2018 02:35
Python script to take care of postgres backup and restore of data
#!/usr/bin/python3
import argparse
import logging
import subprocess
import os
import tempfile
from tempfile import mkstemp
import configparser
import gzip
@awesomebytes
awesomebytes / check_ips_and_ports.py
Created November 24, 2017 06:12
Script to check if IPs in your network have specific port open Python only
#!/usr/bin/env python
import socket
from multiprocessing import Process, Queue
import time
import argparse
"""
Tools to scan network from python.
Mostly taken from stack overflow and mixed together.
@bjverde
bjverde / ConvertUTF-8.py
Last active July 12, 2024 13:40 — forked from smccutchen/ConvertUTF-8.py
Convert multiple files to UTF-8 encoding with Notepad++
# 2016-2017 Soverance Studios.
# Scott McCutchen
# This file will search all files and folders within a given directory, and use Notepad++ to convert their encoding to UTF-8 without Byte Order Marks
#
# This file must be run using the PythonScript plugin from within Notepad++, which is available through the Notepad++ Plugin Manager
#
# You must have Python 2.7 installed
#
# Additionally, this script can only exist and be run from within the Notepad++ user's working directory, the default of which is here:
@rohitrawat
rohitrawat / sources.list
Created June 12, 2017 18:17
Ubuntu 16.04 Xenial default /etc/apt/sources.list
#deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ xenial main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
@kekru
kekru / add CA cert on CentOS Debian Ubuntu.md
Last active July 30, 2025 02:13
Add CA cert to local trust store on CentOS, Debian or Ubuntu
  • Open a webpage that uses the CA with Firefox
  • Click the lock-icon in the addressbar -> show information -> show certificate
  • the certificate viewer will open
  • click details and choose the certificate of the certificate-chain, you want to import to CentOS
  • click "Export..." and save it as .crt file
  • Copy the .crt file to /etc/pki/ca-trust/source/anchors on your CentOS machine
  • run update-ca-trust extract
  • test it with wget https://thewebsite.org
@NathanGiesbrecht
NathanGiesbrecht / noip2.service
Last active October 8, 2025 20:21
Systemd Service file for no-ip.com dynamic ip updater
# Simple No-ip.com Dynamic DNS Updater
#
# By Nathan Giesbrecht (http://nathangiesbrecht.com)
#
# 1) Install binary as described in no-ip.com's source file (assuming results in /usr/local/bin)
# 2) Run sudo /usr/local/bin/noip2 -C to generate configuration file
# 3) Copy this file noip2.service to /etc/systemd/system/
# 4) Execute `sudo systemctl daemon-reload`
# 5) Execute `sudo systemctl enable noip2`
# 6) Execute `sudo systemctl start noip2`