Skip to content

Instantly share code, notes, and snippets.

View bpesquet's full-sized avatar

Baptiste Pesquet bpesquet

View GitHub Profile
@bpesquet
bpesquet / gist:861880571f773e133a9109d90eca33c9
Created September 19, 2019 12:57
Python local installation
# update all packages unprompted
conda update --all -y
# list packages that can be updated
conda search --outdated
from micrograd.engine import Value
# Create a managed scalar value
x = Value(-4.0)
z = 2 * x + 2 + x # z = -10
q = z.relu() + z * x # q = 40
h = (z * z).relu() # h = 100
y = h + q + q * x # y = -20
# Compute gradients w.r.t. input values
from micrograd.nn import Neuron, Layer, MLP
model = MLP(2, [16, 16, 1]) # 2-layer neural network
for k in range(100):
# forward
total_loss, acc = loss()
# backward
model.zero_grad()
export interface User {
mail: string;
password: string;
nickName: string;
}
class UserService {
users: Array<User> = [
{ mail: "test@test.fr", password: "test", nickName: "test" },
{ mail: "admin@test.fr", password: "admin", nickName: "admin" },
export type Year = "1A" | "2A" | "3A";
export interface Module {
id: string;
name: string;
description: string;
teacher: string;
year: Year;
imageUrl: string;
}
Bitmap bmp;
Random rd = new Random();
double xc1 = 200;
double yc1 = 200;
double rayon1 = 150;
double sigma1 = 5.0;
double xc2 = 350;
double yc2 = 220;
double rayon2 = 150;
export interface Todo {
task: string;
completed: boolean;
}
class TodoService {
private todos: Array<Todo> = [];
// Return all todos asynchronously. Returns a Promise
getAll(): Promise<Array<Todo>> {
@bpesquet
bpesquet / todo.service.ts
Created March 1, 2021 17:41
Async storage of todos
import AsyncStorage from "@react-native-async-storage/async-storage";
export interface Todo {
task: string;
completed: boolean;
}
class TodoService {
// Return all todos asynchronously. Returns a Promise
async getAll(): Promise<Array<Todo>> {
using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using MvcUniversity.Models;
namespace MvcUniversity.Data
{
public static class SeedData
{
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using MvcUniversity.Models;
namespace MvcUniversity.Data
{
public static class SeedData