Skip to content

Instantly share code, notes, and snippets.

View AbhishekGhosh's full-sized avatar
❤️
Happy

Abhishek Ghosh AbhishekGhosh

❤️
Happy
View GitHub Profile
@AbhishekGhosh
AbhishekGhosh / xtrabackup_full_increment_restore.sh
Created October 6, 2019 15:27 — forked from SQLadmin/xtrabackup_full_increment_restore.sh
Automate xtrabackup for FULL/Incremental and restore
#!/bin/bash
# This is my production backup script.
# https://sqlgossip.com
set -e
set -u
usage() {
echo "usage: $(basename $0) [option]"
echo "option=full: Perform Full Backup"
@AbhishekGhosh
AbhishekGhosh / flow.json
Created April 13, 2019 17:36
Node-RED push button message
[{"id":"c9dcfc2e.443d2","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ee785b7c.381828","type":"ibmiot in","z":"c9dcfc2e.443d2","authentication":"boundService","apiKey":"","inputType":"evt","logicalInterface":"","ruleId":"","deviceId":"ESP32","applicationId":"","deviceType":"DevBoard","eventType":"sta","commandType":"","format":"json","name":"IBM IoT","service":"registered","allDevices":"","allApplications":"","allDeviceTypes":false,"allLogicalInterfaces":"","allEvents":true,"allCommands":"","allFormats":"","qos":0,"x":100,"y":180,"wires":[["6c1ca6a2.611eb8","d71d6abb.0979e8"]]},{"id":"ffad7349.104be","type":"e-mail","z":"c9dcfc2e.443d2","server":"smtp.gmail.com","port":"465","secure":true,"name":"nobody@gmail.com","dname":"","x":520,"y":240,"wires":[],"inputLabels":["IBM IoT"]},{"id":"6c1ca6a2.611eb8","type":"debug","z":"c9dcfc2e.443d2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":530,"y":100,"wires":[]},{"id":"d71d6abb.0979e8","type":"c
@AbhishekGhosh
AbhishekGhosh / dht11.ino
Created March 17, 2019 20:44
ESP32 DHT11 (Adafruit library)
// copyright thecustomizewindows.com ; abhishek ghosh
// add <Adafruit_Sensor.h>, <DHT.h> and <DHT_U.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTPIN 15 // Pin which is connected to the DHT sensor.
// type the model of sensor in use, we are using DHT 11, if you are using DHT 21 or DHT 22 change it
#define DHTTYPE DHT11
DHT_Unified dht(DHTPIN, DHTTYPE);
@AbhishekGhosh
AbhishekGhosh / snippet.php
Created August 22, 2018 23:22
Fat Free Social Share WordPress
<div class="dev-share-buttons">
<a class="button full facebook" href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>&t=<?php the_title(); ?>" target="_blank" rel="nofollow"> Facebook</a>
<a class="button full twitter" href="https://twitter.com/share?text=<?php the_title(); ?>&url=<?php the_permalink(); ?>&via=AbhishekCTRL" target="_blank" rel="nofollow"> Twitter</a>
<a class="button full google" href="https://plus.google.com/share?url=<?php the_permalink(); ?>" onclick="javascript:window.open(this.href,
'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;" target="_blank" rel="nofollow"> Google+</a>
<a class="button full pinterest" href="https://pinterest.com/pin/create/button/?url=<?php the_permalink(); ?>&media=<?php
$args = array(
'numberposts' => 1,
'order'=> 'DESC',
'post_mime_type' => 'image',
@AbhishekGhosh
AbhishekGhosh / UPDATE.sql
Created June 19, 2018 11:56
WordPress role restore
UPDATE `wp_options` SET option_value='a:1:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:54:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:2
@AbhishekGhosh
AbhishekGhosh / stripped.ipynb
Last active June 1, 2018 03:41
Example stripped off notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AbhishekGhosh
AbhishekGhosh / Table.ipynb
Last active June 1, 2018 03:34
Periodic Table
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AbhishekGhosh
AbhishekGhosh / The-Indian-Penal-Code
Created May 24, 2018 11:18 — forked from allomics/The-Indian-Penal-Code
Central Government Act - The Indian Penal Code
Central Government Act - The Indian Penal Code
==============================================
1. Title and extent of operation of the Code.—This Act shall be called the Indian Penal Code, and shall 1 [extend to the whole of India 2 [except the State of Jammu and Kashmir].]
2. Punishment of offences committed within India.—Every person shall be liable to punishment under this Code and not otherwise for every act or omission contrary to the provisions thereof, of which he shall be guilty within 3 [India] 4 [***].
3. Punishment of offences committed beyond, but which by law may be tried within, India.—Any person liable, by any 5 [Indian law] to be tried for an offence committed beyond [India] shall be dealt with according to the provisions of this Code for any act committed beyond [India] in the same manner as if such act had been committed within 6 [India].
7 [ 4 Extension of Code to extra-territorial offences. —The provi­sions of this Code apply also to any offence committed by—
8 [(1) any citizen of India in
@AbhishekGhosh
AbhishekGhosh / debian-sys-maint.sh
Created May 23, 2018 19:25
Percona debian-sys-maint
#!/bin/sh
MYSQLADMIN_CFG="/etc/mysql/percona-server.conf.d/90-mysqladmin.cnf"
PASS=$(perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)');
sed -i "s/^password =.*$/password = ${PASS}/" /etc/mysql/debian.cnf
sed -i "s/^user =.*$/user = debian-sys-maint/" /etc/mysql/debian.cnf
umask 066
cat > ${MYSQLADMIN_CFG} <<EOF
[mysqladmin]
host = localhost
user = debian-sys-maint
@AbhishekGhosh
AbhishekGhosh / sshfpgen
Created April 28, 2018 06:15
Personal sshfpgen
#!/bin/bash
#
# sshfpgen - Creates SSHFP Records for all available keys
#
HOST="${1-$(hostname -f)}"
if [[ "$1" == "-h" || "$1" == "--help" ]]
then
echo "Usage: sshfpgen <hostname>"