Skip to content

Instantly share code, notes, and snippets.

View yvan-sraka's full-sized avatar

Yvan Sraka yvan-sraka

View GitHub Profile
@chshersh
chshersh / CPS.hs
Last active November 4, 2024 09:07
CPS transformed code
-- Code for the following blog post:
-- https://kodimensional.dev/cps
{-# LANGUAGE LambdaCase #-}
module CPS where
data AppError
= UserSessionIsInvalid
| DbError InternalDbError
@eteq
eteq / parallax_GaiaDR2.ipynb
Last active June 15, 2021 00:37
An demonstration of parallax using stars near the sun from the Gaia mission, astropy, astroquery, and matplotlib.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@edolstra
edolstra / nix-lang.md
Last active October 30, 2024 00:36
Nix language changes

This document contains some ideas for additions to the Nix language.

Motivation

The Nix package manager, Nixpkgs and NixOS currently have several problems:

  • Poor discoverability of package options. Package functions have function arguments like enableFoo, but there is no way for the Nix UI to discover them, let alone to provide programmatic ways to
@woctezuma
woctezuma / hidden_gems_using_playtime.md
Last active December 21, 2020 20:01
Hiddem Gems, using median playtime (forever) as a popularity measure

PC Gamer

If you arrived here from a PC Gamer article, I suggest you check the Python source code and one of these rankings:

  • original ranking, featured on PC Gamer, based on data downloaded prior to the Steam summer sales.
  • updated ranking, using data from June 30, a week after the Steam summer sales have started.

Bug fix regarding ranking based on playtime

Initially, I presented on this Gist page a ranking using playtime as popularity measure. However, as I have kept working on the code, I have found out this ranking likely suffered from a bug. The bug, which is now fixed, resulted in a ranking very similar to the ranking using players total as popularity measure. Thankfully, the ranking featured in the PC Gamer article is bug-free sinc

@yvan-sraka
yvan-sraka / max.py
Last active October 14, 2023 17:00
Max function implementation explained in Python
# Input data
list_0 = [1, 3, 6, 7, 8, 9, 10, 2, 3, 4]
list_1 = [12, 56, 3, 78, 34, 56, 2, 10]
list_2 = [123, 567, 234, 890]
list_3 = [5, 7, 8, 9, 3, -2, -4, -2, 5, 6, 8, 11, 2]
# Iterative algorithm
def maximum(L):
biggest_item = L[0]
for item in L:
@bishboria
bishboria / springer-free-maths-books.md
Last active October 3, 2024 09:17
Springer made a bunch of books available for free, these were the direct links
@robertsdionne
robertsdionne / deepdream-install.md
Last active February 15, 2021 16:07
Deepdream installation
#!/usr/bin/env bash

# Assuming OS X Yosemite 10.10.4

# Install XCode and command line tools
# See https://itunes.apple.com/us/app/xcode/id497799835?mt=12#
# See https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html
xcode-select --install
@Mierdin
Mierdin / pocketdedupe.py
Last active August 16, 2024 09:42
A Python script to intelligently remove duplicate entries from Pocket
#!/usr/bin/env python
from pocket import Pocket
import webbrowser, sys
# Get consumer key from cmd line
consumer_key = sys.argv[1]
request_token = Pocket.get_request_token(
consumer_key=consumer_key,
@ibigbug
ibigbug / brainfuck.py
Last active May 31, 2016 13:34
brainfuck python implement
import sys
"""
A simple and powerful `Brainfuck` interpreter implementation in Python
Steal from: http://blog.csdn.net/redraiment/article/details/7483062
"""
def _gen_array(length):
return [0 for i in range(0, length)]