Skip to content

Instantly share code, notes, and snippets.

@ninadsp
ninadsp / README
Created January 6, 2018 06:58
Airtel Smartbytes Data Consumption Bash One Liner
View README
Credits to:
# Airtel specific
https://github.com/paambaati/airtel-usage
https://gist.github.com/r4um/3414116
# General Bash help
StackOverflow
nixCraft/Vivek Gite
@ninadsp
ninadsp / .bash_aliases.hogwarts
Last active August 22, 2017 10:36
A bunch of bash functions and aliases for Harry Potter fans...
View .bash_aliases.hogwarts
# Harry Potter comes to your bash
# All ye muggles, make life a little magical
accio() {
# Bring files here (to $CWD)
mv $@ .;
};
stupefy() {
# Temporarily stop processes
@ninadsp
ninadsp / notification_cleanup_task.xml
Created August 11, 2016 06:33
Notification SMS Clean up task for Tasker
View notification_cleanup_task.xml
<TaskerData sr="" dvi="1" tv="4.8u5m">
<Task sr="task49">
<cdate>1470858510504</cdate>
<edate>1470869694940</edate>
<id>49</id>
<nme>Notification Sms Cleanup</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>355</code>
<Str sr="arg0" ve="3">%sms_retention_rules</Str>
@ninadsp
ninadsp / 101.xtm
Created May 2, 2016 19:25
Barcamp Bangalore Spring 2016 session - Orchestrating from the Command line
View 101.xtm
;; A demo of Extempore (https://github.com/digego/extempore)
;; Based on tutorials from http://benswift.me/extempore-docs/index.html
;; and tutorials from the source (https://github.com/digego/extempore/tree/master/examples)
;; Step 1 - Fetch source and compile
;; Step 2 - Configure the editor and get a hang of the keyboard shortcuts
;; Step 3 - Evaluate the following code samples one block at a time
;; extempore basics
;; What is the time now
@ninadsp
ninadsp / awk_sum_test.sh
Last active January 11, 2016 06:12
awk_sum_test.sh
View awk_sum_test.sh
echo '1
2
3
4
5' | awk '{sum += $0} END {print sum}'
View elasticsearch.yml
##################### Elasticsearch Configuration Example #####################
# This file contains an overview of various configuration settings,
# targeted at operations staff. Application developers should
# consult the guide at <http://elasticsearch.org/guide>.
#
# The installation procedure is covered at
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>.
#
# Elasticsearch comes with reasonable defaults for most settings,
@ninadsp
ninadsp / README.md
Last active August 26, 2022 15:06
Use jq to conditionally pick up fields from a JSON
View README.md
  • 1.json contains data retrieved from the Instagram API. data is an array of media matching the query posted to Instagram's REST API, in a JSON array.
  • Each media element contains metadata for a photo/video posted to Instagram
  • .data[] loops over each media object in the JSON file, letting us process each element
  • | works like a regular *nix pipe, taking the output of the previous operator and passing it on to the next one.
  • select() filters through objects depending on the rule passed to it.
  • .tags[] returns an array of tags for each media. contains() returns true if the current object passed to it contains the string passed as a parameter. .tags[] | contains("100happydays") iterates over all the tags associated with the media object and returns true if the current tag matches the string 100happydays.
  • .select( .tags[] | contains("100happydays") ) filters all media objects that contain the tag 100happydays
  • .images.standard_resolution.url now
View Makefile
%:
convert postit-blank.png -draw "text 25, 60 $(filter-out $@,$(MAKECMDGOALS))" -pointsize 40 | lp
@ninadsp
ninadsp / 1.sh
Created July 28, 2013 16:11
Code snippets from my blogpost ACAD - How to setup Wordpress on a Ubuntu system (http://ninad.pundaliks.in/blog/2008/08/acad-how-to-setup-wordpress-on-a-ubuntu-system/)
View 1.sh
$ ln -s /var/www/wordpress /path/to/wordpress/directory
@ninadsp
ninadsp / 1.sh
Created July 28, 2013 15:56
Code snippets from my blogpost ACAD - locate files on your Linux system (http://ninad.pundaliks.in/blog/2008/08/acad-locate-files-on-your-linux-system/)
View 1.sh
$ locate [expression]