Skip to content

Instantly share code, notes, and snippets.

@fabiomaggio
fabiomaggio / ckeditor-responsive-images.js
Created January 22, 2016 19:10
Make inserted images in CKEditor automatically responsive
// If you want inserted images in a CKEditor to be responsive
// you can use the following code. It creates a htmlfilter for the
// image tag that replaces inline "width" and "style" definitions with
// their corresponding attributes and add's (in this example) the
// Bootstrap "img-responsive" class.
CKEDITOR.on('instanceReady', function (ev) {
ev.editor.dataProcessor.htmlFilter.addRules( {
elements : {
img: function( el ) {
// Add bootstrap "img-responsive" class to each inserted image
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active January 9, 2025 12:22
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

// ==UserScript==
// @name BlockBlockAdBlock
// @namespace http://github.com/anka-213
// @version 0.1.1
// @description Block the BlockAdBlock script
// @author Andreas Källberg
// @match http://blockadblock.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
@tbreuss
tbreuss / dnsbl.php
Last active October 30, 2024 12:26
IP Blacklist Check Script - This is a simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once.
<?php // Simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once. ?>
<html>
<head>
<title>DNSBL Lookup Tool - IP Blacklist Check Script</title>
</head>
<body>
<h2>IP Blacklist Check Script</h2>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
<input type="text" value="" name="ip"/>
<input type="submit" value="LOOKUP"/>
@ManfMert
ManfMert / Konsole output
Last active January 19, 2017 18:24
Extended version of sshfilter.sh to recognized private ip addresses and realy unknown ip addresses
/var/log/messages
Dec 12 16:03:39 bananapi logger: DENY sshd connection from 113.108.21.16 (CN)
Dec 12 16:12:59 bananapi logger: DENY sshd connection from 185.110.132.202 (IP Address not found)
Dec 12 16:20:12 bananapi logger: DENY sshd connection from 121.18.238.98 (CN)
Dec 12 16:24:57 bananapi logger: DENY sshd connection from 185.110.132.202 (IP Address not found)
Dec 12 16:26:20 bananapi logger: DENY sshd connection from 121.18.238.114 (CN)
Dec 12 16:29:10 bananapi logger: DENY sshd connection from 221.194.44.195 (CN)
Dec 12 16:30:55 bananapi logger: DENY sshd connection from 221.194.47.249 (CN)
Dec 12 16:37:06 bananapi logger: DENY sshd connection from 185.110.132.202 (IP Address not found)
@davidalves1
davidalves1 / desfazendo-push.md
Last active October 7, 2024 14:19
Desfazendo um git push

Desfazendo um git push

Não é possível desfazer um push diretamente, como é feito com o commit utilizando o comando $ git reset --soft|mixed|hard hash-do-penultimo-commit

Para desfazer um push são necessários 3 passos:

  1. Utilizar o comando $ git reset --mixed HEAD~1 e em seguida utilizar o comando $ git stash (se preferir pode usar a opção -m "revertendo o push blablabla" para salvar o stash com um contexto do que foi feito
  2. Utilizar o comando $ git revert HEAD~0
  3. Utilizar o comando $ git stash apply
  4. Utilizar o comando $ git push origin sua-branch -f
@lichti
lichti / letsencrypt-proxmox.md
Last active September 12, 2022 20:14
Proxmox with letsencrypt ssl
git clone https://github.com/certbot/certbot /opt/letsencrypt
ln -s /opt/letsencrypt/certbot-auto /usr/bin/certbot
certbot certonly --expand --agree-tos --text --non-interactive \
 --standalone \
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active March 25, 2025 11:44 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Exporting your 2FA tokens from Authy to transfer them into another 2FA application

IMPORTANT - Update regarding deprecation of Authy desktop apps

Past August 2024, Authy stopped supported the desktop version of their apps:
See Authy is shutting down its desktop app | The 2FA app Authy will only be available on Android and iOS starting in August for details.

And indeed, after a while, Authy changed something in their backend which now prevents the old desktop app from logging in. If you are already logged in, then you are in luck, and you can follow the instructions below to export your tokens.

If you are not logged in anymore, but can find a backup of the necessary files, then restore those files, and re-install Authy 2.2.3 following the instructions below, and it should work as expected.

@zulhfreelancer
zulhfreelancer / install-docker.md
Last active March 22, 2025 14:30
Install Docker oneliner script

Just install Docker

$ curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh

Install Docker and Rancher Server

$ curl -fsSL get.docker.com -o get-docker.sh &amp;&amp; sh get-docker.sh &amp;&amp; sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server

@holmberd
holmberd / linux-kill-pts.md
Last active July 13, 2024 18:38
Kill tty/pts sessions in Linux

Kill user tty/pts sessions in Linux

Commands

  • w: show who is logged on and what they are doing
  • who: show who is logged on
  • tty: show current users pseudo terminal
  • ps -ft pts/1: get process id for the pseudo terminal
  • pkill: signal process based on name and other attributes