Skip to content

Instantly share code, notes, and snippets.


Abhishek Ghosh AbhishekGhosh

View GitHub Profile
# *****************************************************************************
# Copyright (c) 2017, 2019 IBM Corporation and other Contributors.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# *****************************************************************************
import time
AbhishekGhosh /
Created Oct 6, 2019 — forked from SQLadmin/
Automate xtrabackup for FULL/Incremental and restore
# This is my production backup script.
set -e
set -u
usage() {
echo "usage: $(basename $0) [option]"
echo "option=full: Perform Full Backup"
AbhishekGhosh / flow.json
Created Apr 13, 2019
Node-RED push button message
View flow.json
[{"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":"","port":"465","secure":true,"name":"","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 / dht11.ino
Created Mar 17, 2019
ESP32 DHT11 (Adafruit library)
View dht11.ino
// copyright ; 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
AbhishekGhosh / snippet.php
Created Aug 22, 2018
Fat Free Social Share WordPress
View snippet.php
<div class="dev-share-buttons">
<a class="button full facebook" href="<?php the_permalink(); ?>&t=<?php the_title(); ?>" target="_blank" rel="nofollow"> Facebook</a>
<a class="button full twitter" href="<?php the_title(); ?>&url=<?php the_permalink(); ?>&via=AbhishekCTRL" target="_blank" rel="nofollow"> Twitter</a>
<a class="button full google" href="<?php the_permalink(); ?>" onclick=",
'', '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="<?php the_permalink(); ?>&media=<?php
$args = array(
'numberposts' => 1,
'order'=> 'DESC',
'post_mime_type' => 'image',
AbhishekGhosh / UPDATE.sql
Created Jun 19, 2018
WordPress role restore
View UPDATE.sql
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 / stripped.ipynb
Last active Jun 1, 2018
Example stripped off notebook
View stripped.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Table.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
AbhishekGhosh / The-Indian-Penal-Code
Created May 24, 2018 — forked from allomics/The-Indian-Penal-Code
Central Government Act - The Indian Penal Code
View 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 /
Created May 23, 2018
Percona debian-sys-maint
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
host = localhost
user = debian-sys-maint