Skip to content

Instantly share code, notes, and snippets.

Georges Dubus madjar

Block or report user

Report or block madjar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View json-edit.hs
#!/usr/bin/env stack
-- stack --resolver lts-13.15 script
{-# LANGUAGE OverloadedStrings, NoImplicitPrelude #-}
import Language.Haskell.Interpreter
import Options.Applicative.Simple
import Protolude hiding (to)
import Prelude (String)
import Control.Lens hiding (set)
import Data.Aeson
@madjar
madjar / mkLazyBin.nix
Created Jan 16, 2019
Lazy binaries, that install the underlying command on invocation (the missing part is a gc root)
View mkLazyBin.nix
with import <nixpkgs> {};
let
mkLazyBin = { pkg, bin }:
writeTextFile {
name = bin;
executable = true;
text = ''
#!/bin/sh
[[ -d ${builtins.unsafeDiscardStringContext (pkg.outPath)} ]] || nix build --no-link ${builtins.unsafeDiscardStringContext (pkg.drvPath)}
${builtins.unsafeDiscardStringContext (pkg.outPath)}/bin/${bin}
View jsonToDhall.hs
#!/usr/bin/env stack
-- stack --resolver nightly-2018-11-30 script
{-# LANGUAGE OverloadedStrings #-}
import Data.Aeson
import Data.Aeson.Encode.Pretty (encodePretty)
import Dhall
import Dhall.Core
import Dhall.Parser (Src)
import Dhall.TypeCheck (X)
View pipelineDSL.scala
import org.apache.spark.ml.PipelineStage
import org.apache.spark.ml.feature.{OneHotEncoder, VectorAssembler, StringIndexer}
import org.apache.spark.mllib.linalg.VectorUDT
import scala.Function.const
import scala.language.{implicitConversions, reflectiveCalls}
/* Spark Pipeline API is kind of sad to use, so let's make a nicer, more compositional API!
*/
View fix_translation.py
from pathlib import Path
import sys
import itertools
source = Path(sys.argv[1])
target = Path(sys.argv[2])
if target.exists():
print("%s already exists, aborting." % target)
sys.exit()
View update_kf5.py
import os
from collections import namedtuple
import subprocess
import tarfile
import re
import requests
from bs4 import BeautifulSoup
import jinja2
View update_kf5.py
import os
from collections import namedtuple
import subprocess
import tarfile
import re
import requests
from bs4 import BeautifulSoup
import jinja2
View keybase.md

Keybase proof

I hereby claim:

  • I am madjar on github.
  • I am georges (https://keybase.io/georges) on keybase.
  • I have a public key whose fingerprint is F683 691F D4AE A070 B860 077A D62C 17B1 0DE2 67C2

To claim this, I am signing this object:

@madjar
madjar / scrapper.py
Last active Jun 27, 2019
A example of scrapper using asyncio and aiohttp
View scrapper.py
import asyncio
import aiohttp
import bs4
import tqdm
@asyncio.coroutine
def get(*args, **kwargs):
response = yield from aiohttp.request('GET', *args, **kwargs)
return (yield from response.read_and_close(decode=True))
@madjar
madjar / json.rs
Created Oct 20, 2013
A nice Json wrapper for rust
View json.rs
/*
* Hi there !
*
* I found that handling Json was quite annoying, so I wrote this
* little lib to help. You can find an example of the usage in the
* tests at the end.
*
* I lacked inspiration on the naming of value() and item(), and got
* lost in the lifetimes, so from_json takes a Json and not a
* JsonLike.
You can’t perform that action at this time.