def singleton(cls):
instance = cls()
instance.__call__ = lambda: instance
return instance
@singleton
class Highlander:
x = 100
This file contains 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> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <pcap.h> | |
u_char char_to_hex(char c) | |
{ | |
if (c >= '0' && c <= '9') | |
{ | |
return c - '0'; |
This file contains 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
for name, param in model.state_dict().items(): | |
print(name, param.size()) |
This file contains 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
# coding=utf8 | |
import random | |
import torch | |
import torch.nn as nn | |
from torch import optim | |
from torch.autograd import Variable | |
batch_size = 64 | |
n_epochs = 2000 | |
learning_rate = 0.001 |