Skip to content

Instantly share code, notes, and snippets.

View NuniTelo's full-sized avatar
🏠
Working from home

Naun Telo NuniTelo

🏠
Working from home
  • Albania
View GitHub Profile
@ozh
ozh / dalle.md
Last active April 10, 2024 18:12
DALL-E prompts inspiration and examples #dalle #dalle2

Prompts

@duhaime
duhaime / measure_img_similarity.py
Last active March 1, 2023 08:41
Compare image similarity in Python using Structural Similarity, Pixel Comparisons, Wasserstein Distance (Earth Mover's Distance), and SIFT
import warnings
from skimage.measure import compare_ssim
from skimage.transform import resize
from scipy.stats import wasserstein_distance
from scipy.misc import imsave
from scipy.ndimage import imread
import numpy as np
import cv2
##
@ruanbekker
ruanbekker / cheatsheet-elasticsearch.md
Last active April 24, 2024 00:11
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
@dertajora
dertajora / decode_unicode_google_maps_api.php
Last active February 25, 2020 23:03
Decode Encoded Unicode string (field html-instruction) on Google Maps API response
<?php
// Lets say , we want to send a direction request with guidance to Google Maps API using link below.
// https://maps.googleapis.com/maps/api/directions/json?origin=-6.190109,%20106.798565&destination=-6.177596,%20106.792611&key=USEYOUR_KEY
// some of request, especially in field html-instruction would return unicode html text like this one ('Head \u003cb\u003ewest\u003c/b\u003e').
// for some reason, I just want to use the text provided there ('Head west').
// after some googling and asking, here is the best code I have (right now)
# example response
//Type A : There are 2 sentence in one single direction response
@thomasdarimont
thomasdarimont / KeycloakAdminClientExample.java
Last active July 18, 2024 19:18
Using Keycloak Admin Client to create user with roles (Realm and Client level)
package demo.plain;
import org.keycloak.OAuth2Constants;
import org.keycloak.admin.client.CreatedResponseUtil;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.KeycloakBuilder;
import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.admin.client.resource.UserResource;
import org.keycloak.admin.client.resource.UsersResource;
import org.keycloak.representations.idm.ClientRepresentation;
@kob-to-wni
kob-to-wni / webhook-server.js
Last active September 16, 2018 14:30
Node.js Backlog WebHook server
'use strict';
const Http = require('http');
const Request = require('request');
const LISTEN_ADDRESS = '127.0.0.1';
const LISTEN_PORT = 9090;
const REQUEST_TIMEOUT = 1000;
const URL_PREFIX = '/webhook';
const PROXY = '';
@tejpratap46
tejpratap46 / removeDuplicateFromMongoDB.js
Created July 12, 2016 11:19
Delete duplicates from mongodb
`dropDups: true` option is not available in 3.0.
I have solution with aggregation framework for collecting duplicates and then removing in one go.
It might be somewhat slower than system level "index" changes. But it is good by considering way you want to remove duplicate documents.
a. Remove all documents in one go
var duplicates = [];
@rajanski
rajanski / gist:ccf65d4f5106c2cdc70e
Last active October 24, 2021 04:11 — forked from aflaxman/gist:287370
OSM to networkx graph with node coordinates ;-)
"""
Read graphs in Open Street Maps osm format
Based on osm.py from brianw's osmgeocode
http://github.com/brianw/osmgeocode, which is based on osm.py from
comes from Graphserver:
http://github.com/bmander/graphserver/tree/master and is copyright (c)
2007, Brandon Martin-Anderson under the BSD License
"""
import xml.sax
@mabdrabo
mabdrabo / sound_recorder.py
Created January 28, 2014 23:05
Simple script to record sound from the microphone, dependencies: easy_install pyaudio
import pyaudio
import wave
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
CHUNK = 1024
RECORD_SECONDS = 5
WAVE_OUTPUT_FILENAME = "file.wav"
@mharsch
mharsch / gist:5188206
Last active February 8, 2024 02:43
serve HLS (HTTP Live Streaming) content from node.js

HLS streaming from node

Provided that you already have a file or stream segmenter generating your .m3u8 playlist and .ts segment files (such as the ffmpeg 'hls' muxer), this little node server will serve up those files to an HLS compatible client (e.g. Safari). If you're using node for your streaming app already, this obviates the need to serve the HLS stream from a separate web server.

loosely based on https://gist.github.com/bnerd/2011232

// loosely based on https://gist.github.com/bnerd/2011232
// requires node.js >= v0.10.0
// assumes that HLS segmenter filename base is 'out'
// and that the HLS playlist and .ts files are in the current directory