Skip to content

Instantly share code, notes, and snippets.

Avatar

Baptiste Pesquet bpesquet

View GitHub Profile
@bpesquet
bpesquet / todo.service.ts
Created Mar 1, 2021
Async storage of todos
View todo.service.ts
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>> {
View todo.service.ts
export interface Todo {
task: string;
completed: boolean;
}
class TodoService {
private todos: Array<Todo> = [];
// Return all todos asynchronously. Returns a Promise
getAll(): Promise<Array<Todo>> {
View MainForm.cs
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;
View module.service.ts
export type Year = "1A" | "2A" | "3A";
export interface Module {
id: string;
name: string;
description: string;
teacher: string;
year: Year;
imageUrl: string;
}
View authentication.service.ts
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" },
View micrograd_nn_demo.py
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()
View micrograd_autodiff_demo.py
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
View gist:861880571f773e133a9109d90eca33c9
# update all packages unprompted
conda update --all -y
# list packages that can be updated
conda search --outdated
@bpesquet
bpesquet / .eslintrc.json.expo
Created Jan 31, 2019
ESLint configuration file for Expo SDK 32+
View .eslintrc.json.expo
{
"extends": ["airbnb", "prettier", "prettier/react"],
"parser": "babel-eslint",
"env": {
"react-native/react-native": true
},
"plugins": ["react", "react-native"],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
@bpesquet
bpesquet / jupyterhub-install.md
Created Sep 17, 2018
JupyterHub installation on Ubuntu 16.04
View jupyterhub-install.md
  • Ubuntu 16.04
  • CUDA 9.2
  • cuDNN 7.1.4
  • TF dependancies
  • Anaconda 3 in /usr/local/anaconda3
  • Clone TF 1.8
  • Compil TF (Python 3.6 par défaut)
  • Build package TF
  • sudo visudo. Add /usr/local/anaconda3/bin at end of secure_path
  • sudo pip install tensorflow*.whl