Skip to content

Instantly share code, notes, and snippets.

View binarweb's full-sized avatar
🛌
Sleeping at the gym.

Binar Web binarweb

🛌
Sleeping at the gym.
View GitHub Profile
@binarweb
binarweb / LetsEncrypt.md
Created April 16, 2018 15:48 — forked from davestevens/LetsEncrypt.md
Let’s Encrypt setup for Apache, NGINX & Node.js

Let's Encrypt

Examples of getting certificates from Let's Encrypt working on Apache, NGINX and Node.js servers.

Obtain certificates

I chose to use the manual method, you have to make a file available to verify you own the domain. Follow the commands from running

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
@binarweb
binarweb / nginx_config_cloudfront_real_ips.js
Created April 17, 2018 08:47 — forked from radiofrequency/nginx_config_cloudfront_real_ips.js
list cloufront ip ranges for nginx real ip module
var request = require("request");
var fs = require("fs");
var output = "#cloudfront ip ranges\n";
request("https://ip-ranges.amazonaws.com/ip-ranges.json", function(err, res, body) {
if (err) {
console.error("error", err);
}
var j = JSON.parse(body);
j.prefixes.forEach(function(item) {
if (item.service ==='CLOUDFRONT') {
@binarweb
binarweb / nginx-self-signed-ssl-certificate.md
Last active May 25, 2018 09:14 — forked from clemlatz/self-signed-ssl-certificate.md
Setup a self-signed SSL certificate for Nginx (server side only)

Create the certificate:

$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt

Create a strong Diffie-Hellman group:

$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048

Create a new configuration snippet file for Nginx:

@binarweb
binarweb / apache-self-signed-ssl-certificate.md
Last active January 24, 2020 22:54
Setup a self-signed SSL certificate for Apache (server side only)

Create the certificate:

$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt

Create a strong Diffie-Hellman group:

$ openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048

Create an Apache Configuration Snippet with Strong Encryption Settings

@binarweb
binarweb / Github commands.md
Last active January 2, 2024 14:15
Github commands

This tutorial is about setting up a Github account to commit (via SSH) to an existing/new repository and common commands to handle that repository.

1. Setting up git

  • globally (recommended for one github account / OS user)

git config --global user.email "your_email@example.com"
git config --global user.name "Your Name"

  • locally (recommended for multiple github accounts / OS user)
@binarweb
binarweb / clean-up-boot-partition-ubuntu.md
Created October 30, 2018 13:30 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@binarweb
binarweb / rpc-consumer.php
Created December 20, 2019 19:38 — forked from frankmayer/rpc-consumer.php
Consumer and producer files for blog post : http://bit.ly/14SaWpp
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Message\AMQPMessage;
define('AMQP_DEBUG_FM', true);
$host = '127.0.0.1';
//$host = '192.168.2.3';
@binarweb
binarweb / 01-README.md
Created August 30, 2022 09:34 — forked from RundesBalli/01-README.md
Server online-status check with reporting to telegram

Server online-status check with reporting to telegram

This simple script uses netcat to check if - for instance - a webserver is running on a server. If the service is not running, it utilizes the telegram bot API for sending a message to inform the operator of the server.

How to

1. Register the bot

Go to the BotFather bot-account and create a bot by writing /newbot. Then, copy the token.

2. Find your chat-id

Send a message to you newly created bot (you can find the link to your bot in the success message sent by BotFather).

@binarweb
binarweb / bot.rb
Created August 30, 2022 09:36 — forked from dideler/bot.rb
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
@binarweb
binarweb / readme.md
Created August 30, 2022 09:37 — forked from SanariSan/readme.md
Telegram HTTP bot API via CURL | Send text, photos, documents, etc.

Here are some examples on how to use Telegram bot api via CURL

Prerequisites

For getting messages in private chat with bot

  • Create a bot using @BotFather, get it's token
  • Start conversation with bot
  • Run following curl command
curl https://api.telegram.org/bot/getUpdates | grep -Po '"from":{"id":.+?,'