Skip to content

Instantly share code, notes, and snippets.

View Wikidepia's full-sized avatar
🛌
Sedang molor.

Akmal Wikidepia

🛌
Sedang molor.
View GitHub Profile
@PeterZhizhin
PeterZhizhin / jax_ctc.py
Last active September 17, 2021 12:21
Jax CTC loss implementation
import jax.numpy as jnp
import jax
import functools
@jax.jit
def logadd(x0, x1, x2):
# produces nan gradients in backward if -inf log-space zero element is used https://github.com/pytorch/pytorch/issues/31829
#return jax.nn.logsumexp(jnp.stack([x0, x1, x2]), axis=0)
# use if -inf log-space zero element is used
@superfein
superfein / coverageJS.js
Last active February 13, 2023 07:33
Uses the Puppeteer node module to extract the coverage JS from Chrome, for a specific URL.
const puppeteer = require('puppeteer');
// Include to be able to export files with node
const fs = require('fs');
// This prepares the filenames for the coverage .js files
function exportJSFileName(url) {
// Remove https:// from the beginning of the string
// Remove .js* from the end of the string
@Greegko
Greegko / nginx_global_domains.config
Created May 23, 2017 22:03
nginx setup for dynamic domains and their subdomains
# Source: https://stackoverflow.com/questions/8199231/how-to-setup-mass-dynamic-virtual-hosts-in-nginx
server {
listen 80 default_server;
listen [::]:80 default_server;
# Match any server name with the format [subdomain.[.subdomain...]].domain.tld.dev
server_name ~^(?<subdomain>([\w-]+\.)*)?(?<domain>[\w-]+\.[\w-]+)\.dev$;
# Map by default to (projects_root_path)/(domain.tld)/www;
@cowboy
cowboy / 1-file.txt
Last active May 6, 2024 12:29
Iterate over all lines in a file, handing extra trailing newlines
foo bar
baz
qux
last line (there may or may not be a trailing newline after this line)
@madjar
madjar / scrapper.py
Last active March 5, 2023 15:02
A example of scrapper using asyncio and aiohttp
import asyncio
import aiohttp
import bs4
import tqdm
@asyncio.coroutine
def get(*args, **kwargs):
response = yield from aiohttp.request('GET', *args, **kwargs)
return (yield from response.read_and_close(decode=True))