Skip to content

Instantly share code, notes, and snippets.

@rjha
rjha / FibonacciInteger.java
Created December 30, 2020 15:13
Java program to print Very Large Fibonacci numbers by simulating addition in software
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)
======================================
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 April 22, 2016 17:33
Yuktix public API python library
#!/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
#!/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 December 26, 2015 20:53
Arduino core and libraries inside AVR makefile target
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 December 26, 2015 20:45
makefile to compile Arduino Core into a static library
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 December 18, 2015 05:49
Binary search tree (BST) in Java
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 September 12, 2012 13:52
infinite scroll hacked version for PHP pagination with 2 variables
/*
--------------------------------
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 July 10, 2012 17:30
pinterest like image extraction and size determination
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 June 18, 2012 09:32
sendgrid web API wrapper in PHP
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.
*