Skip to content

Instantly share code, notes, and snippets.

View v1bh0r's full-sized avatar

Vibhor Mahajan v1bh0r

View GitHub Profile
@v1bh0r
v1bh0r / accounting.sql
Created February 20, 2024 01:57 — forked from 001101/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
@v1bh0r
v1bh0r / sample-input.xml
Last active November 27, 2021 01:32
XML with namespaces
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<api:Command xmlns:api="http://someservice.com/core/api">
<api:Body>
<api:Item key="standardRequest">
<IDScoreRequest schemaVersion="3.0" xmlns="http://someservice.com/request">
<Identity>
<FirstName>John</FirstName>
@v1bh0r
v1bh0r / run.sh
Created September 27, 2021 04:33
Monitor changes to the code and auto-build
#!/bin/bash
dos2unix mvnw
./mvnw spring-boot:run -Dspring-boot.run.jvmArguments="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" &
while true; do
inotifywait -e modify,create,delete,move -r ./src/ && ./mvnw compile
done
@v1bh0r
v1bh0r / docker-compose.yml
Created September 27, 2021 04:30
Docker Compose file to help develop Spring Boot code locally using docker
version: '3.3'
services:
api:
build:
context: ./
dockerfile: Dockerfile
volumes:
- ./:/app
- ./.m2:/root/.m2
working_dir: /app
@v1bh0r
v1bh0r / Dockerfile
Created September 27, 2021 04:25
Dockerfile to develop Springboot application locally
FROM eclipse-temurin:11
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y inotify-tools dos2unix
ENV HOME=/app
RUN mkdir -p $HOME
WORKDIR $HOME
@v1bh0r
v1bh0r / README.md
Last active February 16, 2020 05:01
null Humla CTF
git clone https://github.com/v1bh0r/juice-shop.git

cd juice-shop

npm install

CTF_KEY=hellonullchandigarh16feb NODE_ENV=ctf npm start
@v1bh0r
v1bh0r / monit.conf
Last active August 29, 2023 07:38
Sidekiq Monit Configuration example
check process sidekiq_myapp
with pidfile /path/to/sidekiq.pid
start program = "bundle exec sidekiq -C /path/to/sidekiq_conf.yml -P /path/to/sidekiq.pid" with timeout 30 seconds
stop program = "kill -s TERM `cat /path/to/sidekiq.pid`" with timeout 30 seconds
if totalmem is greater than 500 MB for 2 cycles then restart # VM bloat is common in Rails apps
if totalmem is greater than 800 MB for 1 cycles then restart # If a rogue job tries to consume memory quickly
group myapp_sidekiq
require 'json'
require 'net/http'
url = URI.parse('http://lpdemo.thirdpillar.com/loanpath-piedmont-web/rest/get/request/16230.json')
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) {|http|http.request(req)}
parsed_json = JSON.parse res.body
document_type_details = []
parsed_json["sr.getEntityResponse"]["list"].each do |list|