Skip to content

Instantly share code, notes, and snippets.

View mratsim's full-sized avatar
:shipit:

Mamy Ratsimbazafy mratsim

:shipit:
  • Paris
View GitHub Profile
@mratsim
mratsim / fetch_page.py
Created April 20, 2017 10:59 — forked from Smerity/fetch_page.py
An example of fetching a page from Common Crawl using the Common Crawl Index
import gzip
import json
import requests
try:
from cStringIO import StringIO
except:
from StringIO import StringIO
# Let's fetch the Common Crawl FAQ using the CC index
resp = requests.get('http://index.commoncrawl.org/CC-MAIN-2015-27-index?url=http%3A%2F%2Fcommoncrawl.org%2Ffaqs%2F&output=json')
@mratsim
mratsim / create_labels.sh
Created September 10, 2017 09:37 — forked from omegahm/create_labels.sh
Create Gtihub labels from Bash
#!/usr/bin/env bash
# Colours picked from https://robinpowered.com/blog/best-practice-system-for-organizing-and-tagging-github-issues/
###
# Label definitions
###
declare -A LABELS
# Platform
@mratsim
mratsim / gist:812fe489ad3f36f912249ca498a4d05d
Created November 1, 2017 14:59 — forked from syoyo/gist:ef68a9c5b46b040e88db
exp() approximate function on Epiphany.
The clock cycle count for "expf()" (reference) is 141645.
The clock cycle count for "expapprox()" is 74.
The clock cycle count for "expapprox4()" is 127 (/4 = 31).
// GCC
#define RESTRICT __restrict__
// Disable range check makes faster evaluation of exp().
@mratsim
mratsim / disable.sh
Created November 25, 2017 16:12
Disable bunch of #$!@ in Sierra (Version 2.1)
#!/bin/bash
# IMPORTANT: You will need to disable SIP aka Rootless in order to fully execute this script, you can reenable it after.
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
# Agents to disable
TODISABLE=('com.apple.security.keychainsyncingoveridsproxy' 'com.apple.personad' 'com.apple.passd' 'com.apple.screensharing.MessagesAgent' 'com.apple.CommCenter-osx' 'com.apple.Maps.mapspushd' 'com.apple.Maps.pushdaemon' 'com.apple.photoanalysisd' 'com.apple.telephonyutilities.callservicesd' 'com.apple.AirPlayUIAgent' 'com.apple.AirPortBaseStationAgent' 'com.apple.CalendarAgent' 'com.apple.DictationIM' 'com.apple.iCloudUserNotifications' 'com.apple.familycircled' 'com.apple.familycontrols.useragent' 'com.apple.familynotificationd' 'com.apple.gamed' 'com.apple.icloud.findmydeviced.findmydevi
@mratsim
mratsim / UInt256.swift
Created February 15, 2018 09:18 — forked from zackshapiro/UInt256.swift
An implementation of UInt256 based off of https://github.com/Jitsusama/UInt128
//
// UInt256.swift
// Raiblocks
//
// Created by Zack Shapiro on 12/4/17.
// Copyright © 2017 Zack Shapiro. All rights reserved.
//
// MARK: Error Type
@mratsim
mratsim / bsr.cpp
Created March 25, 2018 23:28 — forked from primenumber/bsr.cpp
Parallel bit scan reverse
// author: prime (prime@kmc.gr.jp)
// License: MIT License
#include <iostream>
#include <vector>
#include <bitset>
#include <x86intrin.h>
#include <boost/timer/timer.hpp>
inline __m256i bsr_256_8_naive(__m256i x);
inline __m256i bsr_256_8_cvtfloat(__m256i x);
@mratsim
mratsim / dl-frameworks.rst
Created May 11, 2018 12:14 — forked from bartvm/dl-frameworks.rst
A comparison of deep learning frameworks

A comparison of Theano with other deep learning frameworks, highlighting a series of low-level design choices in no particular order.

Overview

Symbolic: Theano, CGT; Automatic: Torch, MXNet

Symbolic and automatic differentiation are often confused or used interchangeably, although their implementations are significantly different.

@mratsim
mratsim / lagrangeprop.py
Created October 1, 2018 12:41 — forked from timvieira/lagrangeprop.py
Automatic differentiation as the method of Lagrange multipliers. Code accompanies this blog post: http://timvieira.github.io/blog/post/2017/08/18/backprop-is-not-just-the-chain-rule/
# -*- coding: utf-8 -*-
"""
Backprop as the method of Lagrange multiplers (and even the implicit function
theorem).
"""
from __future__ import division
import numpy as np
from arsenal.alphabet import Alphabet
from arsenal.math.checkgrad import finite_difference
@mratsim
mratsim / min-char-rnn.py
Created December 9, 2018 20:10 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)