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
@sualeh
sualeh / how_to_sign_and_release_to_the_central_repository_with_github_actions.md
Last active April 5, 2024 05:55
How to Sign and Release to The Central Repository with GitHub Actions

How to Sign and Release to The Central Repository with GitHub Actions

GitHub allows automated builds using GitHub Actions. A commonly asked question is how to release artifacts (packaged Java jars) built by Maven and Gradle to The Central Repository. The GitHub Actions documentation provides only part of the answer.

So, first, configure your Maven project for staging artifacts to The Central Repository, by reading through Configuring Your Project for Deployment and following those steps. Please make sure that the maven-gpg-plugin is configured to prevent gpg from using PIN entry programs, as follows:

<configuration>
  <gpgArguments>
      <arg>--pinentry-mode</arg>
 loopback
@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
@wojteklu
wojteklu / clean_code.md
Last active April 25, 2024 19:12
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@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.

@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@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.
@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;