Skip to content

Instantly share code, notes, and snippets.

View versvs's full-sized avatar

versvs

View GitHub Profile
import openai
import telegram
# Configura la API de ChatGPT
openai.api_key = "TU_API_KEY"
# Configura el bot de telegram
bot = telegram.Bot(token="TU_TOKEN_BOT")
# Esta función se ejecutará cuando el usuario envíe un mensaje al bot
# -r, copy recursively
# -p, maintain permissions of the files
# -i, without specifying the private key, the ssh auth will not work
# -o ignore on screen logs that would disrupt the scp protocol
# to copy from remote to local, just change the order of the two last parameters
scp -i .ssh/login-key.key -o "StrictHostKeyChecking no" -rp /source/folder username@remote_hostname_or_ip:/destination/folder/
@versvs
versvs / basic-config-hardening-ubuntu-server.sh
Last active January 26, 2019 19:18
Basic config and hardening of an Ubuntu server
##########################################################################################
# Basic configuration and some simple hardening for an Debian/Ubuntu server
##########################################################################################
# This guide assume that a fresh server is being configured.
# It is assumed that the user has root priviledges,
# and most of the sentences are to be run as superuser (root)
# Root Passwd;
docker cp <containerId>:/file/path/within/container /host/path/target
@versvs
versvs / get-hardware-stats.sh
Created March 21, 2018 06:37
small bash script to get the basic hardware stats of a CentOS machine
#!/bin/bash
# Clear the initial creen contents
clear
echo ------------------------------------------------------------------
echo CPU info [Number, type, speed...]
echo ------------------------------------------------------------------
lscpu
echo ------------------------------------------------------------------
@versvs
versvs / pull-start-cloudera.sh
Last active February 16, 2018 11:27
Start cloudera inside a Docker container
# Pulls the image (4Gb!)
docker pull cloudera/quickstart
# Ports to be opened (most commonly used)
# - 8888 expose hue interface
# - 7180 expose cloudera manager
# - 80 expose cloudera examples
# - 8983 expose port of Web UI solr search
# - 50070 expose name node web ui interface
# - 50090 expose secondary name node
@versvs
versvs / template-multisite.yml
Created December 5, 2017 08:08
discourse multisite template
# this is the all-in-one, standalone Discourse Docker container template
##
## After making changes to this file, you MUST rebuild
## /var/discourse/launcher rebuild app
##
## BE *VERY* CAREFUL WHEN EDITING!
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
## visit http://www.yamllint.com/ to validate this file as needed
templates:
@versvs
versvs / git-tag-delete-local-and-remote.sh
Created October 20, 2017 08:32 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
#!/bin/sh
# old-files.sh - Borrado sessiones de XXXX para XXXX.
#
# Añadido por Cartograf XXXX-XX-XX, añadido en user XXXX por limpieza
# y organizacion
#
# Debemos añadir el fichero a cron (/etc/cron.d/old-files, o similar)
#
# ---------------------------------------------------
# Cron para backups
@versvs
versvs / htaccess-made-easy
Last active August 29, 2015 14:15
Common .htaccess settings for various issues
# .htaccess Snippets
A collection of useful .htaccess, all in one place. I decided to create this repo after getting so tired (and bored) with Googling everytime there's a need of forcing `www` for my new website.
**Disclaimer**: While dropping the snippet into an `.htaccess` file is most of the time sufficient, there are cases when certain modifications might be required. Use with your own risks.
**NOTE**: Apache 2.4 introduces a few breaking changes, most notably in access control configuration. For more information, check the [upgrading document](https://httpd.apache.org/docs/2.4/upgrading.html) as well as [this issue](https://github.com/phanan/htaccess/issues/2).
## Table of Contents
- [Rewrite and Redirection](#rewrite-and-redirection)
- [Force www](#force-www)