Skip to content

Instantly share code, notes, and snippets.

View aussetg's full-sized avatar

Guillaume Ausset aussetg

View GitHub Profile
... answer said require line and column. So implement that. Need maybe not touch LSP output normalization in lspPositionToExternal/diagnostic snapshots.
Implementation: modify positions.ts externalPositionToLsp to strict. Maybe rename? The function currently from service. It can return undefined if invalid. But error messages say "requires 1-based line and character". It should not floor floats. It should require Number.isInteger and >=1. For column, if not number returns undefined. Should we default column=1? The old allowed missing char. But "Require column >=1". So no default. This affects codeActions with missing char; okay. We'll update error messages maybe "line and column" not character. Since service methods named character param. But tool uses column alias. In hintForError accepts both. Could leave "character" for legacy? Could make "line and column". But service is generic LSP method; parameter called character. However user-facing contract says column. We could use "line and column" in errors for
\documentclass{minimal} % Default font size and paper size
\usepackage{fontspec} % For loading fonts
\setmainfont[RawFeature={-calt}, Renderer=Harfbuzz]{PragmataPro Liga}[
UprightFont={*Regular},
ItalicFont={*Italic},
BoldFont={*Bold},
BoldItalicFont={*Bold Italic},
]
using DiffEqFlux
using Zygote
nn = FastChain((x,p) -> p)
p = rand(2, 2)
x = rand(1, 100)
function f(p)
gz, back = Zygote.pullback(z -> nn(z, p), x)
back(gz)[1]
julia> CuArrays.zeros(128, 32) |> nn
┌ Warning: calls to Base intrinsics might be GPU incompatible
│ exception =
│ You called exp(x::T) where T<:Union{Float32, Float64} in Base.Math at special/exp.jl:75, maybe you intended to call exp(x::Float32) in CUDAnative at /home/guillaume/.julia/packages/CUDAnative/hfulr/src/device/cuda/math.jl:101 instead?
│ Stacktrace:
│ [1] exp at special/exp.jl:75
│ [2] mish at /home/guillaume/.julia/packages/NNlib/FAI3o/src/activation.jl:206
│ [3] #25 at /home/guillaume/.julia/packages/GPUArrays/1wgPO/src/broadcast.jl:49
└ @ CUDAnative ~/.julia/packages/CUDAnative/hfulr/src/compiler/irgen.jl:111
┌ Warning: calls to Base intrinsics might be GPU incompatible
@aussetg
aussetg / spider.py
Created August 4, 2019 13:07
Spider to scrape Twitter
# -*- coding: utf-8 -*-
import scrapy
import datetime
import json
from TwitterScraper.items import Tweet
from urllib.parse import quote
from bs4 import BeautifulSoup
from scrapy.http import HtmlResponse
from dateutil.parser import parse
@aussetg
aussetg / fb.py
Created January 23, 2017 10:24 — forked from sushain97/fb.py
Downloads, archives, analyzes and plots Facebook Messenger conversations (individual and group)
#!/usr/bin/env python3
import collections
import copy
import datetime
import functools
import itertools
import json
import lzma
import gzip
@aussetg
aussetg / log
Created November 24, 2015 20:04
mxnet ) R CMD INSTALL mxnet_0.5.tar.gz
* installing to library ‘/home/guillaume/R/x86_64-pc-linux-gnu-library/3.2’
* installing *source* package ‘mxnet’ ...
** libs
g++-4.9 -I/usr/share/R/include -DNDEBUG -I../inst/include -I"/home/guillaume/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c executor.cc -o executor.o
g++-4.9 -I/usr/share/R/include -DNDEBUG -I../inst/include -I"/home/guillaume/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c export.cc -o export.o
g++-4.9 -I/usr/share/R/include -DNDEBUG -I../inst/include -I"/home/guillaume/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c io.cc -o io.o
g++-4.9 -I/usr/share/R/include -DNDEBUG -I../inst/include -I"/home/guillaume/R/x86_64-pc-linux-gnu-library/3.2/Rcpp
@aussetg
aussetg / test.tex
Last active November 13, 2015 12:47
Test
\section{Théorie}
\subsection{L'apprentissage machine}
Initialement une branche des statistiques, l'apprentissage statistique s'est rapidement transformé en une discipline à part entière mêlant plusieurs domaines des mathématiques et de l'informatique: l'apprentissage machine.
Le terme \emph{apprentissage statistique} en lui-même est vague et regroupe plusieurs sous-domaines. De façon générale on dispose d'un échantillon $\mathcal{L}$ d'individus possédant des caractéristiques $X_i \in \mathcal{X}$ propres considérées comme déterministes appelées variables et un attribut aléatoire $Y \in \mathcal{Y}$. Si $\mathcal{Y}$ est un ensemble discret on parle de problème de \emph{classification}, s’il est continu on parle alors de problème de \emph{régression}. Il existe un grand nombre d'autres objectifs comme le \emph{clustering}, la \emph{détection de structures} et autres, mais nous ne nous intéresserons ici qu'à ces deux grandes familles en choisissant à chaque fois la tache qui facilite les explications ou es
@aussetg
aussetg / bsc.cpp
Created February 11, 2015 13:17
bsc.cpp
double bsc(double x, double T, double K,double L, double r,double sigma) {
double lambda = (r+sigma*sigma*0.5)/(sigma*sigma) ;
double x1 = log(x/L)/(sigma*sqrt(T)) + lambda * sigma * sqrt(T) ;
double y1 = log(L/x)/(sigma*sqrt(T)) + lambda * sigma * sqrt(T) ;
double d1 = ( log(x/K) + (r+sigma*sigma*0.5)*T ) / (sigma * sqrt(T)) ;
double d2 = d1 - sigma * sqrt(T) ;
double y = log(L*L/(x*K)) / (sigma * sqrt(T)) + lambda * sigma * sqrt(T) ;
double cui = x * N(x1) - K * exp(-r*T) * N(x1 - sigma * sqrt(T)) - x * pow(L/x,2*lambda) * ( N(-y) - N(-y1) ) + K * exp(-r*T) * pow(L/x,2*lambda-2) * ( N(-y+sigma*sqrt(T)) - N(-y1 + sigma*sqrt(T)) ) ;
double c = x * N(d1) - K* exp(-r*T) * N(d2) ;
return(c - cui );