Skip to content

Instantly share code, notes, and snippets.

View hardiksondagar's full-sized avatar

Hardik Sondagar hardiksondagar

View GitHub Profile
@hardiksondagar
hardiksondagar / dict_merge.py
Created February 26, 2019 11:48 — forked from angstwad/dict_merge.py
Recursive dictionary merge in Python
# Recursive dictionary merge
# Copyright (C) 2016 Paul Durivage <pauldurivage+github@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@hardiksondagar
hardiksondagar / bbb_boot_service_instructions.md
Created June 20, 2018 12:12 — forked from tstellanova/bbb_boot_service_instructions.md
How to setup a service to automatically run a python script when the BeagleBone Black (BBB) reboots. These instructions allow you to setup a python script to automatically start when the BeagleBone (running Angstrom linux with systemd) restarts.

Creating a service to startup at BeagleBone Black boot time:

  • Create a shell script such as /usr/bin/myFancyBash.sh:

      #!/bin/bash
    
      # this could be any runnable code or shell script, really
      /usr/bin/myFancyPython.py 
    

Note that the first line is critical.

@hardiksondagar
hardiksondagar / monitor_service.py
Created June 20, 2018 12:12 — forked from piraz/monitor_service.py
Script that monitors a service running on systemd. If service is not running the script will try to start the service.
#!/bin/python
#
# Copyright 2016 Flavio Garcia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@hardiksondagar
hardiksondagar / gist:0040a2dd5589158d4e033fdcf16b57c3
Created January 24, 2017 12:46 — forked from thomseddon/gist:3511330
AngularJS byte format filter
app.filter('bytes', function() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});
@hardiksondagar
hardiksondagar / instagramFollowerScrapper.js
Last active June 10, 2023 09:25 — forked from suprememoocow/intercept.js
Instagram follower web scrapper.
/**
*
* Instagram Follower Web Scrapper
*
* Steps to use.
* 1. Open instagram user's profile in browser https://www.instagram.com/tvfpitchers/
* 2. Open console ( press F12 in chrome ) and paste all the code below
* 3. Click on followers button and load all the followers
* 4. Call function downloadAsCsv() by writing "downloadAsCsv()" in console to download csv file containing user's all the followers .
*