Skip to content

Instantly share code, notes, and snippets.

@leonirlopes
leonirlopes / check_update.sh
Created July 18, 2022 19:27 — forked from codatory/check_update.sh
CentOS / Fedora Weekly update checking script
#!/bin/bash
UPDATES=`yum check-update -q | awk '{print $1}'`
COUNT=`printf "%s\n" "$UPDATES" | grep -v "^$" | wc -l`
YUM=`printf "%s\n" "$UPDATES" | grep -v "^$" | grep yum`
echo '--------------------------------------------------------------------------------'
echo " Weekly Update Notification for `hostname`"
echo " -> $COUNT update(s) available"
if [ -n "$YUM" ]; then
echo ' -> IMPORTANT: A Yum update is available. Perform this separately and first.'
fi
@leonirlopes
leonirlopes / tg.sh
Last active July 13, 2022 12:56 — forked from HirbodBehnam/tg.sh
Telegram bash shell upload file ~ A dead simple script to upload files on your server through Telegram bot
#!/bin/bash
# This is a simple script that takes some files as arguments and sends them to a special chat
# Just create a new bot at @BotFather and get your chat ID from @myidbot and enter them here
# You can also make a shortcut in '~/.bashrc' like "alias tg='bash /opt/scripts/tg.sh'"
# After that restart bash and use it like 'tg file1.txt file2.jpg'
# EDIT TOKEN and CHAT_ID:
TOKEN="TOKEN"
CHAT_ID="12341234"
# Make sure curl is installed
for arg in "$@"
@leonirlopes
leonirlopes / index.html
Created May 20, 2022 17:03 — forked from leowebguy/index.html
Responsive iframe full screen. Display page without and hide original url address.
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<style>
html body {width: 100%;height: 100%;padding: 0px;margin: 0px;overflow: hidden;font-family: arial;font-size: 10px;color: #6e6e6e;background-color: #000;} #preview-frame {width: 100%;background-color: #fff;}</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
//function to fix height of iframe!
var calcHeight = function() {
@leonirlopes
leonirlopes / rmhash.sh
Created March 31, 2022 14:31 — forked from apolzek/rmhash.sh
Remove files with the same hash
# by: apolzek
md5sum * | sort -n > .file
filename='.file'
n=1
x=1
while read line; do
current_hash=$(echo $line | awk {'print $1'})
echo "[debugging] current_hash: $current_hash"
x=$(($n + 1))
// ==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==
@leonirlopes
leonirlopes / linux-kill-pts.md
Created September 21, 2020 18:38 — forked from holmberd/linux-kill-pts.md
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
@leonirlopes
leonirlopes / letsencrypt-proxmox.md
Created September 7, 2020 14:09 — forked from lichti/letsencrypt-proxmox.md
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 \
@leonirlopes
leonirlopes / desfazendo-push.md
Created December 27, 2017 17:10 — forked from davidalves1/desfazendo-push.md
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 hash-do-penultimo-commit e em seguida utilizar o comando $ git stash
  2. Utilizar o comando $ git revert hash-do-ultimo-commit
  3. Utilizar o comando $ git stash apply
<?php
$str_conn="firebird:host=localhost;dbname=/var/lib/firebird/2.5/data/employee.fdb;charset=UTF8";
$dbh = new PDO($str_conn, "sysdba", "masterkey");
?>
@leonirlopes
leonirlopes / curl-smtp-email.sh
Created March 31, 2017 12:24 — forked from james2doyle/curl-smtp-email.sh
Send SMTP email using cURL
curl --connect-timeout 15 -v --insecure "smtp://smtp.example.com:25" -u "username:password"
\ --mail-from "sender@example.com" --mail-rcpt "destination@example.com"
\ -T email-contents.txt --ssl