Skip to content

Instantly share code, notes, and snippets.

View d3ep4k's full-sized avatar
🏠
Working from home

Deepak Mishra d3ep4k

🏠
Working from home
View GitHub Profile
​def f(x){ // we are taking equation as x^3+x-1
def f = 2*x + x - 1;
return f;
}
def secant(x1, x2, E) {
def n = 0, xm, x0, c;
const searchBox = document.getElementById('searchbox');
const dropdownMenu = document.getElementById('dropdown-menu');
const searchBoxContainer = document.getElementById('searchbox-container');
searchBox.addEventListener("keyup", function(event) {
const timer = setTimeout(function () {
var sr = event.target.value;
if(!sr) return; //Do nothing for empty value
searchBoxContainer.classList.add("control", "is-loading");
@d3ep4k
d3ep4k / paytm-orders-export.js
Last active March 12, 2020 12:43
JS code to organise paytm orders to be exported as csv
// records = []
columns = []
document.querySelectorAll("._2PmH5").forEach( record => {
columns=[]
record.childNodes.forEach( column =>
columns.push(column.textContent.trim())
);
str = JSON.stringify(columns);
// debugger;
// console.log(str)
<jsp:directive.include file="../fragments/mason-init.jspf"/>
<m:resource>
<m:request method="GET">
<sql:query var="result" dataSource="${datasource}">
SELECT * FROM movie
</sql:query>
<c:set target="${output}" property="output" value="${result}"/>
</m:request>
@d3ep4k
d3ep4k / external.xml
Last active June 23, 2019 08:39
External API request example using XRequest feature in metamug console
<?xml version="1.0" encoding="UTF-8" ?>
<Resource xmlns="http://xml.metamug.net/resource/1.0" v="1.0">
<Request method="GET">
<XRequest id="xrequest" method="GET"
url="https://postman-echo.com/get?foo1=bar1&amp;foo2=bar2"
/>
</Request>
</Resource>
@d3ep4k
d3ep4k / hello.xml
Last active June 23, 2019 07:36
When condition example with param example
<?xml version="1.0" encoding="UTF-8" ?>
<Resource xmlns="http://xml.metamug.net/resource/1.0" v="1.0">
<Request method="GET">
<Desc> Say hello to different species </Desc>
<Param name="type" type="text" minlength="1" />
<!-- http://localhost:7000/backend/v1.0/hello?type=animal -->
<Sql id="helloAnimals" when="$type eq animal"> SELECT 'Hello animals' as "message" </Sql>
<!-- http://localhost:7000/backend/v1.0/hello?type=plant -->
<Sql id="helloPlants" when="$type eq plant"> SELECT 'Hello plants' as "message" </Sql>
</Request>
GroovyScriptEngine engine = new GroovyScriptEngine(".");
Map<String, String> request = new HashMap();
request.put("param1", "Hello");
Map<String, String> response = new HashMap();
response.put("param1", "World");
Binding binding = new Binding();
binding.setVariable("request", request);
binding.setVariable("response", response);
engine.run("src/main/java/"+className, binding);
class MtgOutput{
private Map<String, Object> map;
public Output(Map<String, Object> map){
this.map = map;
}
protected abstract String processJSONObject(JSONObject obj);
protected abstract String processJSONArray(JSONArray obj);
protected abstract String processString(String obj);
import java.util.concurrent.ThreadLocalRandom;
public class Probability {
public static void main(String[] args){
if(args.length != 2){
System.out.println("java Probability <Samples> <Probability percentage>");
System.exit(0);
}
@d3ep4k
d3ep4k / router-password.md
Last active November 25, 2018 14:00
Router default username and password.

Skyworth

Username: admin

Password: br0adband

Technicolor TC7210.dNZ

Username: