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
package main | |
import "fmt" | |
func orChan(chans ...chan interface{}) chan interface{} { | |
switch len(chans) { | |
case 0: | |
return nil | |
case 1: | |
return chans[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
package main | |
import ( | |
"fmt" | |
) | |
type TreeNode struct { | |
Val int | |
Left *TreeNode | |
Right *TreeNode |
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
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse |
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
#set connection data accordingly | |
source_host=*.*.*.* | |
source_port=6379 | |
target_host=*.*.*.* | |
target_port=6379 | |
passwd=redisPasswd | |
key=testKey | |
redis-cli --raw -h $source_host -p $source_port -a $passwd DUMP "$key" | head -c -1 | redis-cli -x -h $target_host -p $target_port -a $passwd RESTORE "$key" 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
// https://stackoverflow.com/questions/14184099/fastest-way-to-remove-duplicate-documents-in-mongodb | |
var duplicates = []; | |
db.getCollection("appstore").aggregate([ | |
{ $match: { | |
game: { "$eq": 'yyygg' } // discard selection criteria | |
}}, | |
{ $group: { | |
_id: { userReviewId: "$userReviewId"}, // can be grouped on multiple properties |
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 pymysql | |
db_conf_dev = { | |
'NAME': '', | |
'USER': '', | |
'PASSWORD': '', | |
'HOST': '', | |
'PORT': 3307 | |
} | |
db_conf_prod = { |
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
image: "python:3.7" | |
before_script: | |
- python --version | |
- pip install -r requirements.txt | |
stages: | |
- Static Analysis | |
- Test |
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 GAN(): | |
def __init__(self): | |
self.img_rows = 28 | |
self.img_cols = 28 | |
self.channels = 1 | |
self.img_shape = (self.img_rows, self.img_cols, self.channels) | |
optimizer = Adam(0.0002, 0.5) | |
# Build and compile the discriminator |
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
activation_model = keras.models.Model(inputs=model.input, outputs=[layer.output for layer in model.layers]) | |
layer_names = [] | |
for layer in model.layers[:8]: | |
layer_names.append(layer.name) | |
images_per_row = 8 | |
for layer_name, layer_activation in zip(layer_names, activations): | |
n_features = layer_activation.shape[-1] | |
size1 = layer_activation.shape[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/python3 | |
for i in iter(int, 1): | |
... |