Skip to content

Instantly share code, notes, and snippets.

@rjha
rjha / FibonacciInteger.java
Created Dec 30, 2020
Java program to print Very Large Fibonacci numbers by simulating addition in software
View FibonacciInteger.java
package com.yuktix.test.fib;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
/*
* The Java program to print Large Fibonacci numbers by simulating addition
* of 2 integers using stacks to keep individual digits. Trivial
* implementations using native INT type will overflow because even F(100)
View mysql will not start after 8.0.15 to 8.0.16 update on Ubuntu 16.04 LTS
======================================
mysql 8.0.15 -> 8.0.16 upgrade error
======================================
1) The mysql server refused to start when we upgraded from 8.0.15 to 8.0.16
on Ubuntu 16.04
Apr 25 09:08:09 yuktix-apiv11devm1 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
@rjha
rjha / yuktix.py
Created Apr 22, 2016
Yuktix public API python library
View yuktix.py
#!/usr/bin/python
import time
from datetime import datetime
from datetime import timedelta
import json
import requests
import random
import sys
import traceback
import logging
View aws.py
#!/usr/bin/python
import json
import requests
import random
import sys
import traceback
import logging
import logging.handlers
import yuktix
import time
@rjha
rjha / avr.make
Created Dec 26, 2015
Arduino core and libraries inside AVR makefile target
View avr.make
wiznet: spi2
$(BIN)/avr-g++ $(CFLAGS) -I$(LIB)/arduino/SPI -I$(INC) -I$(LIB)/arduino/cores -I$(LIB)/arduino/variants/mega -I$(LIB)/wiznet $(LIB)/wiznet/w5100.cpp -o $(BUILD)/w5500.o -L$(BUILD)
$(BIN)/avr-g++ $(CFLAGS) -I$(INC) -I$(LIB)/arduino/cores -I$(LIB)/arduino/variants/mega -I$(LIB)/wiznet $(LIB)/wiznet/socket.cpp -o $(BUILD)/socket.o -L$(BUILD)
spi2:
$(BIN)/avr-g++ $(CFLAGS) -I$(LIB)/arduino/cores -I$(LIB)/arduino/variants/mega -I$(LIB)/arduino/SPI $(LIB)/arduino/SPI/SPI.cpp -o $(BUILD)/SPI.o -L$(LIB)/arduino/build -larduino
ethernet: wiznet
$(BIN)/avr-g++ $(CFLAGS) -I$(INC) -I$(LIB)/wiznet -I$(LIB)/arduino/cores -I$(LIB)/arduino/variants/mega -I$(LIB)/arduino/Ethernet $(LIB)/arduino/Ethernet/Dns.cpp -o $(BUILD)/Dns.o -L$(BUILD) -L$(LIB)/arduino/build -larduino
@rjha
rjha / gist:b7cda6312552c3e15486
Created Dec 26, 2015
makefile to compile Arduino Core into a static library
View gist:b7cda6312552c3e15486
BIN=C:/arduino-1.0.5-r2/hardware/tools/avr/bin
TOOLS=C:/arduino-1.0.5-r2/hardware/tools/avr/bin
LIB=d:/rajeev/code/bitbucket/dl/lib
INC=d:/rajeev/code/bitbucket/dl/include
ROOT=d:/rajeev/code/bitbucket/dl
PROG=aout
MCU=atmega2560
ASRC=d:/rajeev/code/bitbucket/dl/lib/arduino
CPU_SPEED=16000000L
@rjha
rjha / gist:5735459
Last active Dec 18, 2015
Binary search tree (BST) in Java
View gist:5735459
package test ;
/* educational purpose Binary search tree */
/* @author http://github.com/rjha */
public class bst {
private Node root ;
@rjha
rjha / jquery.infinitescroll.hacked.js
Created Sep 12, 2012
infinite scroll hacked version for PHP pagination with 2 variables
View jquery.infinitescroll.hacked.js
/*
--------------------------------
Infinite Scroll
--------------------------------
+ https://github.com/paulirish/infinite-scroll
+ version 2.0b2.120519
+ Copyright 2011/12 Paul Irish & Luke Shumard
+ Licensed under the MIT license
+ Documentation: http://infinite-scroll.com/
@rjha
rjha / image-extraction.js
Created Jul 10, 2012
pinterest like image extraction and size determination
View image-extraction.js
webgloo.imagep = new Image();
webgloo.imagep.onload = function() {
if(webgloo.sc.ImageSelector.debug){
console.log(this.src + " : " + this.width + "x" + this.height);
}
if((this.width >= 300) && (this.height >= 300 )) {
webgloo.sc.ImageSelector.addImage(this.src);
}
@rjha
rjha / sendgrid-wrapper
Created Jun 18, 2012
sendgrid web API wrapper in PHP
View sendgrid-wrapper
namespace com\indigloo\mail {
use com\indigloo\Util as Util ;
use com\indigloo\Configuration as Config ;
use com\indigloo\Logger as Logger ;
/**
* class to wrap sendgrid-php web API.
* sendgrid-php web API uses curl to communicate to sendgrid endpoint.
*