Skip to content

Instantly share code, notes, and snippets.

View silentsudo's full-sized avatar

Ashish Agre silentsudo

  • Bangalore
View GitHub Profile
@silentsudo
silentsudo / save-img-to-folder.patch
Last active October 12, 2024 10:13
comfyui save image like automatic1111
index 01ae821..bc0668e 100644
--- a/folder_paths.py
+++ b/folder_paths.py
@@ -4,6 +4,7 @@ import os
import time
import mimetypes
import logging
+import datetime
from typing import Set, List, Dict, Tuple, Literal
from collections.abc import Collection
package in.silentsudo.springintegrations.jms;
import jakarta.jms.ConnectionFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jms.DefaultJmsListenerContainerFactoryConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.jms.ChannelPublishingJmsMessageListener;
@silentsudo
silentsudo / produst-search.json
Created January 15, 2023 06:02
should match search as you type
DELETE products
PUT products
{
"mappings": {
"properties": {
"title": {
"type": "search_as_you_type"
}
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
SELECT f.id as feed_id, u.name, u.email,
(select count(*) FROM jpatest.likes where feed_id = f.id) as likes_count,
(select count(*) FROM jpatest.comments where feed_id = f.id) as comments_count
FROM feeds f
LEFT JOIN users u
ON f.user_id = u.id
WHERE u.id = 12055;
SELECT
id,
address,
(6371 *
ACOS(COS(RADIANS(12.972442)) * COS(RADIANS(latitude)) * COS(RADIANS(longitude) -
RADIANS(77.580643)) + SIN(RADIANS(12.972442)) * SIN(RADIANS(latitude)))) AS distance
FROM
address
HAVING distance < 5
ORDER BY distance
SELECT f.id, u.email,
count(distinct l.id) as likes_count,
count(distinct c.id) as comments_count
FROM feeds f
INNER JOIN users u ON f.user_id = u.id
INNER JOIN likes l on l.feed_id = f.id
left join comments c on c.feed_id = f.id
WHERE u.id = 12055
group by f.id order by comments_count asc;
@silentsudo
silentsudo / completable-futures-example.java
Created June 19, 2021 03:45
example showing simple use of completable futures
package examples;
import java.time.Duration;
import java.time.LocalTime;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;
import java.util.stream.Collectors;
@silentsudo
silentsudo / random-string.sh
Created May 29, 2021 14:07
ubuntu-random-string
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1
@silentsudo
silentsudo / twitter-input-plugin.conf
Created May 20, 2021 06:41
logstash twitter input plugin
input {
twitter {
consumer_key => "${TWITTER_KEY}"
consumer_secret => "${TWITTER_SECRET}"
oauth_token => "${TWITTER_OAUTH_TOKEN}"
oauth_token_secret => "${TWITTER_OAUTH_SECRET}"
ignore_retweets => true
full_tweet => true
keywords=> ["java", "springboot"]
}