Skip to content

Instantly share code, notes, and snippets.

View Kurukshetran's full-sized avatar
🎯
Focusing

Kurukshetran Kurukshetran

🎯
Focusing
View GitHub Profile
@Kurukshetran
Kurukshetran / App.java
Created June 2, 2021 16:12 — forked from thomasdarimont/App.java
Example for refreshable Groovy Scripts via Java Config. RefreshableGroovyScript is a FactoryBean that produces Proxies backed by a RefreshableTargetSource. Changes in the groovy script are picked up after the configured time interval.
package demo;
import static java.util.concurrent.TimeUnit.*;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class App {
import java.util.*;
public class MutableJson {
public static void main(String[] args) {
MutableJson json = new MutableJson(
new HashMap<String, Object>() {{
put("store", new HashMap<String, Object>() {{
put("name", "Some Store");
put("books", Arrays.asList(
@Kurukshetran
Kurukshetran / Application.java
Created October 8, 2020 09:15 — forked from serac/Application.java
Configuring RestTemplate for Client TLS in a Spring Boot Application
/*
* See LICENSE for licensing and NOTICE for copyright.
*/
package edu.vt.middleware.app;
import java.io.File;
import java.security.*;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
@Kurukshetran
Kurukshetran / gist:1f24885b57690a0715fc1248977fb8c7
Created September 19, 2020 10:06 — forked from douglasjarquin/gist:2208690
Amazon RDS Performance Tuning Settings
rds-modify-db-parameter-group {param-group-name} \
--parameters="name=character_set_server, value=utf8, method=pending-reboot" \
--parameters="name=collation_server, value=utf8_general_ci, method=pending-reboot" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=query_cache_type, value=1, method=pending-reboot" \
--parameters="name=query_cache_size, value=131072, method=pending-reboot" \
--parameters="name=table_open_cache, value=2500, method=pending-reboot" \
--parameters="name=join_buffer_size, value={DBInstanceClassMemory/64}, method=pending-reboot" \
--parameters="name=thread_cache_size, value={DBInstanceClassMemory/12582880}, method=pending-reboot" \
@Kurukshetran
Kurukshetran / dlAttachments.py
Created August 25, 2020 13:06 — forked from baali/dlAttachments.py
Python script to download all gmail attachments.
# Something in lines of http://stackoverflow.com/questions/348630/how-can-i-download-all-emails-with-attachments-from-gmail
# Make sure you have IMAP enabled in your gmail settings.
# Right now it won't download same file name twice even if their contents are different.
import email
import getpass, imaplib
import os
import sys
detach_dir = '.'
@Kurukshetran
Kurukshetran / email_attachments_download.py
Created August 25, 2020 13:06 — forked from kngeno/email_attachments_download.py
A python script to download email attachments from specific email addresses
"""
Python 2.7/3.6 compatible
GMAIL Accounts
A script to download email attachments from specific email addresses
Please edit the following details to work:
YOUR_EMAIL_ADDRESS
YOUR_EMAIL_PASSWORD
LABEL - Inbox, Trash, Archive, ...
RECEIVING_EMAIL_ADDRESS
RECEIVING_SUBJECT - '*' for all OR 'Title of Subject'
@Kurukshetran
Kurukshetran / user.js
Created August 20, 2020 09:43 — forked from EtienneR/user.js
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@Kurukshetran
Kurukshetran / _ocr2.py
Created July 23, 2020 12:38 — forked from dmgig/_ocr2.py
Multithreaded OCR Process with Tesseract, TEXTCLEANER, and imagemagick
#!/usr/bin/python
import os
import sys
import getopt
import subprocess
import time
import pytesseract
import argparse
import cv2
@Kurukshetran
Kurukshetran / apache-balancer.sh
Created June 25, 2020 07:11 — forked from SeonghoonKim/apache-balancer.sh
Apache HTTPD balancer-manager control script
#! /bin/sh
# Set up a default search path
PATH="/usr/bin:/bin"
CURL=`which curl`
if [ -z "$CURL" ]; then
echo "curl not found"
exit 1
fi
@Kurukshetran
Kurukshetran / AMQMOnitorConf.py
Created January 3, 2020 06:53 — forked from Abhinav2510/AMQMOnitorConf.py
AMQ Monitoring and Email Alerts script
#Replace localhost with your servername
#Change username and password accordingly
#Alert can be applied on JVM Heap and Queue parameters
#Alert format is
# param=Name of parameter on whose value you want to put alert
# thresholdVal= Value againsts which current value of param will be evaluated as per condition
# condition= denotes how to compare thresholdVal and current value of parameter.
# Possible values are as below:
# lt - Alert will be raised if current value is less than thresholdVal
# gt - Alert will be raised if current value is greater than thresholdVal