Skip to content

Instantly share code, notes, and snippets.

Sanjeev Shrestha sanjeevshrestha

Block or report user

Report or block sanjeevshrestha

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
sanjeevshrestha / telegraf-dockercompose.yml
Last active Oct 11, 2019
Telegraf Docker Compose file
View telegraf-dockercompose.yml
image: telegraf
restart: always
HOST_PROC: /rootfs/proc
HOST_SYS: /rootfs/sys
HOST_ETC: /rootfs/etc
hostname: localhost
- ./telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
sanjeevshrestha /
Created May 26, 2017 — forked from staltz/
The introduction to Reactive Programming you've been missing
sanjeevshrestha /
Created Mar 31, 2017
Creating JSON with Jackson
ObjectMapper mapper = new ObjectMapper();
ArrayNode arrayNode = mapper.createArrayNode();
ObjectNode objectNode1 = mapper.createObjectNode();
objectNode1.put("bookName", "Java");
objectNode1.put("price", "100");
ObjectNode objectNode2 = mapper.createObjectNode();
objectNode2.put("bookName", "Spring");
sanjeevshrestha / Vagrantfile
Created Oct 3, 2016 — forked from aweijnitz/Vagrantfile
This is a Vagrant file and a provisioning script to create a Debian-based Jenkins server, including Java, Ant and Tomcat. Also see "" below
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
# Named boxes, like this one, don't need a URL, since the are looked up
sanjeevshrestha / Swapping two numbers without third variable
Created Jul 6, 2016
Swapping two numbers without third variable in java
View Swapping two numbers without third variable
public static void swap1(int a, int b) {
System.out.println("The intital value " + a + " " + b);
a = a + b;
b = a - b;
a = a - b;
System.out.println("The swapped value " + a + " " + b);
sanjeevshrestha / Adding numbers without + Operator
Created Jul 6, 2016
Adding numbers without + Operator in Java
View Adding numbers without + Operator
public static int addIter(int a, int b) {
while (b != 0) {
int carry = a & b;
a = a ^ b;
b = carry << 1;
return a;
sanjeevshrestha / Joomla-two-column-admin-menu
Created Mar 14, 2015
Making Joomla 3.4.x administrator menu 2 column
View Joomla-two-column-admin-menu
* @author Sanjeev Shrestha <>
* 14/03/2015
* Add a class to Menu Node For the menu in the administrator/mod_menu/tmpl/default_enabled.php
* Here I am making the admin components menu 2 column
* Add a class to 'components' menu node creator in file administrator/mod_menu/tmpl/default_enabled.php
View gist:5feb13d1abde14c82b17
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
sanjeevshrestha / menutype.php
Created Apr 9, 2012
Joomla 2.5.x! com_menu menutypes model changes
View menutype.php
* Changes to menutypes.php method 'getTypeOptionsFromXML'
* Why? Currently the menutype does not allow to insert other many variables from metadata.xml file. This makes is rigid if any developer wants to add a variable to the menu url. Yes there is request field type but it does not server the purpose. I don't want to confuse people and also i want to use the same name for multiple state vars.
* How? Allow devs to insert variables as an attribute in menu option item as shown below
* e.g.
* <metadata>
* <menu>
* <options var="view">
* <option value="lists" name="Lists" msg="Listing" />
* <option value="messages" name="Messages" role='message.pms.exec' msg="Messages" />
You can’t perform that action at this time.