Skip to content

Instantly share code, notes, and snippets.

View ashgkwd's full-sized avatar
💎
Open to work

Ash Gaikwad ashgkwd

💎
Open to work
View GitHub Profile
@ashgkwd
ashgkwd / agbashrc.sh
Last active November 27, 2018 12:17
A bash rc add-on which contains simple functions and aliases which are generally used by the author
# @author: Ashish Gawikwad <ash.gkwd@gmail.com>
# @license: MIT License
# @script: It contains all the functions and aliases which
# are frequently used by author.
#
sleepToRAM () {
dbus-send --system --print-reply \
--dest="org.freedesktop.UPower" \
/org/freedesktop/UPower \
@ashgkwd
ashgkwd / usb_power_cycle_reset.sh
Created August 5, 2015 14:00
Reset Power Cycles in USB Ports. Run this function as root user. You can include this fule in .bashrc, if you are frequent user.
powerCycleUSB_3 () {
for i in $(ls /sys/bus/pci/drivers/xhci_hcd/|grep :)
do echo $i >/sys/bus/pci/drivers/xhci_hcd/unbind
echo $i >/sys/bus/pci/drivers/xhci_hcd/bind
done
}
powerCycleUSB_2 () {
for i in $(ls /sys/bus/pci/drivers/ehci_hcd/|grep :)
do echo $i >/sys/bus/pci/drivers/ehci_hcd/unbind
@ashgkwd
ashgkwd / slack_post.py
Created December 18, 2015 14:20
Post messages in your slack from commandline. Configurable python script. I use it for auto test updates from embedded devices.
"""
Author: Ashish Gaikwad <ash.gkwd@gmail.com>
Description: This script will post a message on your slack channel
Please configure your `/etc/slack_post.cfg` file first.
Example slack_post.cfg
[slack]
url=https://hooks.slack.com/services/XxXxXxXxXx
channel=botwa
@ashgkwd
ashgkwd / PouchDB Basics.js
Created September 16, 2016 09:44
Basic CURD Operations in browser using PouchDB
var db = new PouchDB('ar-db');
var leads = [{
_id: 'a'+Date.now(),
name: "Murali Prasad Sharma",
contact: [{
handle: "9867327500",
channel: "Mobile"
}, {
handle: "ash.gkwd@gmail.com",
channel: "Email"
@ashgkwd
ashgkwd / Google Spreadsheet Result Generator.gs
Created October 3, 2016 07:00
Adds "Super Awesome Menu" from which you can generate result sheet base on Google form responce sheet
function onOpen() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var menu = [];
menu.push({name: "Get Results", functionName: "logData_"});
spreadsheet.addMenu("Super Awesome Menu", menu);
}
function logData_() {
Logger.log("This is my log, it's awesome :)");
var dest = copySheet_();
@ashgkwd
ashgkwd / .gitconfig
Created August 18, 2019 07:13
Some handy commands for Git users. Put it in your ~/.gitconfig
[core]
editor = vi
[alias]
spull = !git-svn fetch && git-svn rebase
spush = !git-svn dcommit
send = !git spull && git spush
up = pull --rebase
on = push origin master
co = checkout
import hashlib
passwd = "mywalletpassword"
salt = "summersaltstringwhichislong"
p = 1
r = 8
n = 262144
dklen = 32
dec_key = hashlib.scrypt(bytes(passwd, 'utf-8'), salt=bytes.fromhex(salt), n=n, r=r, p=p, maxmem=2000000000, dklen=dklen)
print(dec_key)
@ashgkwd
ashgkwd / disable-two-fingers-on-brave.sh
Created August 18, 2021 17:58
Disables two finger back and forward gestures on macOS for Brave browser
# Set your app name - the Chromium Browser (i.e Chrome, Brave) in a variable.
appName="Brave"
# Get the bundle Id of the Chromium Browser, store it in a variable.
bundleID=$(osascript -e 'id of app "'$appName'"')
# Example: Get the bundle Id of Brave browser
# Returns:
# com.brave.Browser
@ashgkwd
ashgkwd / deploy-to-bucket.sh
Last active November 9, 2022 15:56
Deploy to GCS bucket for static website hosting
DOMAIN_NAME="my.web.site";
PROJECT_ID="my-gcp-project-id";
# create bucket of domain name
gsutil mb -p $PROJECT_ID -b on gs://$DOMAIN_NAME
# set index file
gsutil web set -m index.html gs://$DOMAIN_NAME
# set error file
@ashgkwd
ashgkwd / Cable.js
Created December 29, 2021 10:42
Connect to WebSocket opened by ActionCable
export function Cable() {
function _initSocket({
url = "ws://localhost:4080/cable", // Take from config
onOpen,
onClose,
onError,
onMessage,
}) {
Cable.socket = new WebSocket(url);
Cable.socket.onopen = onOpen;