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
from PIL import Image | |
img = Image.open('./icon.png') | |
sizes = [16, 32, 128, 256, 512] | |
for s in sizes: | |
img_resized = img.resize((s, s)) | |
img_resized.save(f'./dist/icon-{s}x{s}@1x.png') |
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 re | |
import sys | |
f = open(sys.argv[-1], 'r+') | |
document = f.read() | |
build = '' | |
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
class MulticlassAverageRecall(Layer): | |
def __init__(self, name='multiclass_recall', classes=4, | |
output_idx=0, **kwargs): | |
super(MulticlassAverageRecall, self).__init__(name=name, **kwargs) | |
self.stateful = True | |
self.classes = classes | |
self.output_idx = output_idx | |
self.t = K.variable(np.zeros(classes), dtype='int32') |
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
import math | |
import pandas as pd | |
import numpy as np | |
from keras.models import Model | |
from keras.callbacks import Callback | |
from sklearn.metrics import confusion_matrix | |
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
import os | |
import time | |
import argparse | |
import GPUtil | |
from multiprocessing import Process | |
parser = argparse.ArgumentParser(description='GPU Bastard, control the resource belong to you!') | |
parser.add_argument('--index', | |
help='GPU Index', |
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
''' | |
Automatic Keras callback class for: | |
- Confusion matrix calculation | |
- Weighted accuracy(AKA. WA) | |
- Unweighted accuracy(AKA. UA) | |
- Label distribution | |
- Predict correctness | |
Dependences: pandas, numpy |
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
var func1 = function() { | |
return new Promise(function(resolve) { | |
setTimeout(function() { | |
console.log('func1'); | |
resolve(); | |
}, 500); | |
}); | |
}; | |
var func2 = function() { | |
return new Promise(function(resolve) { |
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
#include <iostream> | |
int boxes[10] = {5, 3, 2, 7, 10, 9, 1, 6, 4, 8}; | |
int lemons[10] = {2, 6, 7, 1, 10, 5, 4, 3, 9, 8}; | |
int main() { | |
int globalMax = -1; | |
for (int k = 0; k < 10; k++) { | |
int i = k, j = 0; |
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
function * selfIncreasement() { | |
let i = 0 | |
while (true) { | |
i++ | |
yield console.log(i) | |
} | |
} | |
let a = selfIncreasement() |
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
let result = window.location.href | |
.split('?')[1] | |
.split('&') | |
.map(v => v.split('=')) | |
.reduce((obj, v) => { obj[v[0]] = v[1]; return obj }, {}) | |
console.log(result) |
NewerOlder