This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on https://github.com/wzell/mann/blob/master/models/maximum_mean_discrepancy.py | |
# that didn't work for me on tensorflow | |
import tensorflow as tf | |
def gaussian_kernel(x1, x2, beta = 1.0): | |
r = tf.transpose(x1) | |
r = tf.expand_dims(r, 2) | |
return tf.reduce_sum(K.exp( -beta * K.square(r - x2)), axis=-1) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import base64 | |
import json | |
import fileinput | |
for jwt in fileinput.input(): | |
parts = jwt.split(".") | |
# '==' is padding |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# takes text on stdin and stores it in the clipboard | |
# depends on gtk (i.e. a gnome desktop or something alike) | |
import gi | |
gi.require_version('Gtk', '3.0') | |
from gi.repository import Gtk, Gdk | |
import fileinput |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import subprocess | |
import json | |
import os | |
import math | |
import sys | |
def human_readable_size(size_bytes): | |
"""Convert bytes to human-readable file size.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<!-- Tailwind CSS via CDN --> | |
<link href="https://cdn.jsdelivr.net/npm/daisyui@5" rel="stylesheet" type="text/css" /> | |
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script> | |
<link href="https://cdn.jsdelivr.net/npm/daisyui@5/themes.css" rel="stylesheet" type="text/css" /> | |
<script type="module" src="https://unpkg.com/cally"></script> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# DJANGO_DB=database.sqlite python3 django_singlefile.py runserver | |
from django.conf import settings | |
from django.core.management import execute_from_command_line | |
from django.http import HttpResponse, HttpResponseRedirect | |
from django.urls import path | |
from django.db import models | |
from django import forms | |
from django.shortcuts import render |
OlderNewer