Skip to content

Instantly share code, notes, and snippets.

View lezwon's full-sized avatar

Lezwon Castelino lezwon

View GitHub Profile
#include <Python.h>
#include <string.h>
static PyObject* name(PyObject *self, PyObject* args){
char *name;
char greeting[255] = "Hello ";
if (!PyArg_ParseTuple(args, "s", &name)){
return NULL;
}
import requests
import copy
import time
from datetime import datetime
import json
API_KEY = '<API KEY>'
USER_ID = '<USER ID>'
VC = '<VC>'
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
import socket
from select import select
from collections import deque
import time
import heapq
class Scheduler:
def __init__(self):
self.ready = deque() # Holds the tasks to be executed
import os
import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.utils.data import DataLoader
from torchvision.datasets import MNIST
import torchvision.transforms as transforms
from torch.utils.data import random_split
import torch.optim as optim
from torch.optim.lr_scheduler import StepLR
@lezwon
lezwon / lightning.py
Created March 14, 2020 15:09
Training a classification model with PyTorch Lightning
import pretrainedmodels
import logging
import torch.nn.functional as F
from torch import nn
import torch
import pytorch_lightning as pl
from torch.utils.data import DataLoader
from tqdm.notebook import tqdm
class ShutdownInstanceCallback(pl.Callback):
0x0f671fd08592586816810ed6175d047a20e047c7
@lezwon
lezwon / hadoop-install.sh
Last active September 25, 2017 23:28
Installs Hadoop on Ubuntu
sudo apt-get install default-jdk ssh
sudo addgroup hadoop
sudo adduser --ingroup hadoop hduser
sudo adduser hduser sudo
sudo echo "ubuntu localhost=(hduser) NOPASSWD: ALL" >> /etc/sudoers
ssh-keygen -t rsa -P ""
ssh-copy-id user@host
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
ssh localhost
ssh 0.0.0.0