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 / enableSelect-bookmarklet.html
Created March 24, 2023 12:38 — forked from duzun/enableSelect-bookmarklet.html
Enable Right Click and Text Selection Bookmarklet
<a class="btn btn-default btn-info bookmarklet" href="javascript:(function(d){var a=d.document,h=function(){},c=a.body||a.getElementsByTagName("body")[0],f=a.documentElement||a.getElementsByTagName("html")[0],k=[c,f,a],l=["webkit","khtml","moz","ms",""],g=["contextmenu","selectstart","select","mousedown","mouseup"],b=d.Selection,e=b&&b.prototype;e&&(e.removeAllRanges=h,b=a.selection)&&(b.clear=h);for(e=k.length;e--;)if(f=k[e]){for(b=g.length;b--;)f["on"+g[b]]=null;if(a=f.style)for(a.cursor="",a.webkitTouchCallout="initial",b=l.length;b--;)a[((c=l[b])?"-"+c+"-":c)+"user-select"]="initial"}(c=d.jQuery||d.Zepto)&&c(d).off(g)})(this);">
Enable Select
</a>
@binarweb
binarweb / main.py
Created December 5, 2022 18:40 — forked from FulcronZ/main.py
Python MQTT Logging Handler
"""
MIT License
Copyright (c) 2016 Pipat Methavanitpong
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@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":.+?,'
@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 / 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 / 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 / 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 / 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 / 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 / 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: