Skip to content

Instantly share code, notes, and snippets.

View danielcestari's full-sized avatar

Daniel Cestari danielcestari

  • São Carlos, Brazil
View GitHub Profile
@dimartinot
dimartinot / quadruplet_loss.py
Created June 28, 2020 21:44
Quadruplet loss function
class QuadrupletLoss(torch.nn.Module):
"""
Quadruplet loss function.
Builds on the Triplet Loss and takes 4 data input: one anchor, one positive and two negative examples. The negative examples needs not to be matching the anchor, the positive and each other.
"""
def __init__(self, margin1=2.0, margin2=1.0):
super(QuadrupletLoss, self).__init__()
self.margin1 = margin1
self.margin2 = margin2
@pcurylo
pcurylo / lxde_shortcuts
Last active August 23, 2025 20:56
LXDE Shortcuts
Default LXDE/Openbox bindings
ACTION BINDING
Go to desktop (direction) ctrl + alt + arrow
Go to desktop (number) super + f1/f2/f3/f4
Send to desktop shift + alt + arrow
Toggle show desktop super + d
Close window alt + f4
Hide window alt + esc
Window menu alt + space
@vasanthk
vasanthk / System Design.md
Last active March 18, 2026 09:58
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@max-mapper
max-mapper / 0.md
Last active May 12, 2025 13:51
JS hoisting by example

JavaScript function hoisting by example

Below are many examples of function hoisting behavior in JavaScript. Ones marked as works successfuly print 'hi!' without errors.

To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js

Notes on hoisting

(I may be using incorrect terms below, please forgive me)

@guerrerocarlos
guerrerocarlos / middleware.py
Created October 31, 2012 22:47 — forked from strogonoff/middleware.py
Django middleware for cross-domain XHR
from django import http
try:
from django.conf import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
XS_SHARING_ALLOWED_METHODS = settings.XS_SHARING_ALLOWED_METHODS
XS_SHARING_ALLOWED_HEADERS = settings.XS_SHARING_ALLOWED_HEADERS
XS_SHARING_ALLOWED_CREDENTIALS = settings.XS_SHARING_ALLOWED_CREDENTIALS
except AttributeError:
XS_SHARING_ALLOWED_ORIGINS = '*'
@marcgg
marcgg / gist:733592
Created December 8, 2010 17:26
Regex to get the Facebook Page ID from a given URL
# Matches patterns such as:
# https://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/#!/my_page_id => my_page_id
# http://www.facebook.com/pages/Paris-France/Vanity-Url/123456?v=app_555 => 123456
# http://www.facebook.com/pages/Vanity-Url/45678 => 45678
# http://www.facebook.com/#!/page_with_1_number => page_with_1_number
# http://www.facebook.com/bounce_page#!/pages/Vanity-Url/45678 => 45678
# http://www.facebook.com/bounce_page#!/my_page_id?v=app_166292090072334 => my_page_id
# http://www.facebook.com/my.page.is.great => my.page.is.great