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
@kaisteel
kaisteel / page.xml
Last active April 7, 2017 09:20
Pagination example with Metamug resource file
<?xml version="1.0" encoding="UTF-8" ?>
<Resource xmlns="http://xml.metamug.net/resource/1.0" v="1.0">
<Request method="GET">
<Desc>Request to display a single page.
User needs to calculate offset = limit + offset
for each subsequent request. Offset is 900 i.e There are 1000 records.
Limit being 100, Page size cannot be more than 100.
</Desc>
<Param name="limit" type="number" min="0" max="100"/>
<Param name="offset" type="number" min="0" max="900"/>
@d3ep4k
d3ep4k / Probability.java
Last active April 21, 2017 10:39
To know that your chances improve if you keep trying. :)
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 / todo.xml
Last active June 8, 2017 09:40
Multiple queries using variables - Metamug Resource File
<Resource v="0.8" xmlns="http://xml.metamug.net/resource/1.0">
<Request method="GET" >
<Update>
set @count := 0
</Update>
<Query>
select @count := a from todo
</Query>
<Query>
select @count
@refactornator
refactornator / MyData.csv
Last active January 17, 2021 11:04
Upload a CSV file in the body of a HTTP POST request.
product price quantity
widget1 19.95 10
widget2 24.00 20
widget1 12.00 40
@yoshiki
yoshiki / pom.xml
Created October 13, 2011 02:27
Maven pom.xml for Android project
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.android</groupId>
<artifactId>my-android-app</artifactId>
<version>0.1</version>
<packaging>apk</packaging>
@amatellanes
amatellanes / sublime.sh
Last active October 26, 2021 20:34
Install Sublime Text 3 on Ubuntu 14.04 LTS (Trusty Tahr)
sudo add-apt-repository ppa:webupd8team/sublime-text-3;
sudo apt-get update;
sudo apt-get install sublime-text-installer;
sudo ln -s /usr/lib/sublime-text-3/sublime_text /usr/local/bin/sublime;
@jewelsea
jewelsea / H2app.java
Created February 14, 2013 19:32
Sample for accessing a local database from JavaFX.
import java.sql.*;
import java.util.logging.*;
import javafx.application.Application;
import javafx.collections.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
@porjo
porjo / timelapse.md
Last active May 25, 2023 16:14
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

Simple glob:

ffmpeg -r 24 -i '*.JPG' -s hd1080 -vcodec libx264 timelapse.mp4

Start from DSC_0079.JPG

ffmpeg -r 24 -f image2 -start_number 79 -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse2.mp4
@subfuzion
subfuzion / http-status-codes.md
Last active September 3, 2023 09:15
General REST API HTTP Status Codes

Reference: RFC 2616 - HTTP Status Code Definitions

General

  • 400 BAD REQUEST: The request was invalid or cannot be otherwise served. An accompanying error message will explain further. For security reasons, requests without authentication are considered invalid and will yield this response.
  • 401 UNAUTHORIZED: The authentication credentials are missing, or if supplied are not valid or not sufficient to access the resource.
  • 403 FORBIDDEN: The request has been refused. See the accompanying message for the specific reason (most likely for exceeding rate limit).
  • 404 NOT FOUND: The URI requested is invalid or the resource requested does not exists.
  • 406 NOT ACCEPTABLE: The request specified an invalid format.
@lemiorhan
lemiorhan / ReleaseViaJGitFlow.md
Last active October 21, 2023 03:57
How to make a release with Git and Maven via JGitFlow

How to make a release with Git and Maven via JGitFlow

Imagine that you are versioning your sourcecode in git and building your code via maven. You need to make releases before deploying to production regularly. What should be the strategy we need to follow for releasing?

I've used maven-release-plugin for years to make releases. It worked perfectly with maven and svn, but we started to face problems when we migrated our code to git and to make releases on git.

After checking the literature, we decided to use JGit-Flow which is a maven plugin based on and is a replacement for the maven-release-plugin enabling support for git-flow style releases via maven.

I do not want to explain the details much because there are many great posts explaining all.