import torch | |
import numpy as np | |
import k_diffusion as K | |
from PIL import Image | |
from torch import autocast | |
from einops import rearrange, repeat | |
def pil_img_to_torch(pil_img, half=False): | |
image = np.array(pil_img).astype(np.float32) / 255.0 |
I was attempting to generate a list of links and found that some of them needed query params and others didn't. I could not find a recommended way to pass in a dynamic query-params object to the link-to helper. I ended up finding a solution in the Ember Discourse and decided to make it into an ember helper.
Helper:
import Ember from 'ember';
export function dynamicParams([routeName, params]/*, hash*/) {
return [
#!/usr/bin/python3 | |
#-*- encoding: Utf-8 -*- | |
from re import sub, match | |
from struct import pack | |
from urllib.request import Request, urlopen | |
# From objdump output, reconstruct a basic ELF file with symbols suitable for IDA. | |
level = 1 | |
api_key = 'YOU API KEY HERE' |
Version: 0.0.1 updated 7/1/2016
Cordova Plugins are the magic that enable our mobile web app content to access the full power of Native SDKs underneath, but through clean JavaScript APIs that work the same across all platforms we target.
Building Cordova plugins is scary for many Cordova and Ionic developers, but it doesn't have to be. This simple guide walks through the what, when, why, and how of Cordova plugin development for iOS and Android.
/** | |
* Lodash mixins for combinatorics | |
* by: wassname & visangela | |
* url: https://gist.github.com/wassname/a882ac3981c8e18d2556/edit | |
* lodash contrib issue: https://github.com/node4good/lodash-contrib/issues/47 | |
* lic: same as lodash | |
* Inspired by python itertools: https://docs.python.org/2.7/library/itertools.html | |
* | |
* Usage: | |
* permutations([0,1,2],2) // [[0,1],[0,2],[1,0],[1,2],[2,0],[2,1]] |
#!/bin/bash | |
# This is a very naive script, it doesn't do grouping and returns all branches | |
# I only really care about branches that have not seen commits in two months | |
# | |
# I am hoping to find some time to write a tool that can output these reports for me | |
# In the meantime, I am using this | |
echo "Merged branches" | |
for branch in `git branch -r --merged | grep -v HEAD`;do echo -e `git log --no-merges -n 1 --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch; done | sort -r |