Skip to content

Instantly share code, notes, and snippets.

View Centril's full-sized avatar
🏠
Working from home

Mazdak Farrokhzad Centril

🏠
Working from home
  • Sweden
View GitHub Profile
@Centril
Centril / philips-tv-unknown-sources
Created March 26, 2015 17:54
how to enable unknown sources in a Philips TV (android)
1. Download [terminal emulator] from playstore.
2. Open [terminal emulator] and execute the following: `am start --user 0 -n com.android.settings/.SecuritySettings`. This will launch the Security Settings which Philips has hidden.
3. Scroll down and: Enable unknown sources.
4. Profit.
<!-- references -->
[terminal emulator]: https://play.google.com/store/apps/details?id=jackpal.androidterm
@Centril
Centril / combinators.hs
Created January 13, 2017 21:35
useful higher order combinators in haskell
(.$) :: (t -> b -> c) -> (a -> b) -> t -> a -> c
(.$) f g a = f a . g
infixr 8 .$
-- | '.|': Compose an unary function with a binary function.
-- from: http://hackage.haskell.org/package/pointless-fun-1.1.0.5/docs/Data-Function-Pointless.html
(.|) :: (b -> c) -> (t -> a -> b) -> t -> a -> c
(.|) f g a = f . g a
infixr 7 .|
@Centril
Centril / test-indexed-state-monad.hs
Last active May 23, 2022 16:45
Testing indexed state monad transformers
--------------------------------------------------------------------------------
-- Copyright : (C) 2008 Edward Kmett, 2016 Mazdak Farrokhzad
-- License : BSD-style
--------------------------------------------------------------------------------
{-# LANGUAGE GeneralizedNewtypeDeriving, FlexibleInstances,
UndecidableInstances, MultiParamTypeClasses #-}
import Control.Applicative(Alternative)
import Control.Monad.Identity
import Control.Monad.State
@Centril
Centril / atb-nested-lifetime-bounds.rs
Created June 5, 2019 19:56
Old test for nested lifetimes in associated type bounds
// compile-fail
#![feature(associated_type_bounds)]
use std::fmt::Debug;
trait Lam<Binder> { type App; }
fn nested_bounds<_0, _1, _2, D>()
where
@Centril
Centril / await.md
Last active April 30, 2019 13:52
Centril's views on the "Await Syntax Write Up"

Centril's views on the "Await Syntax Write Up"

in our opinion this — which we will call the "error handling problem” — remains the primary problem that we are trying to resolve.

I don't agree that this is the primary problem; it's one of many problems to resolve; Chaining (and thus not forcing temporaries), general composability, and working well with IDEs is among notable problems.

Syntactic Sugar Solution:

I think it is a stretch to call this syntactic sugar in the first place. The syntax await? is composing await + ?. In my view this is not enough semantic compression to be deserving of the description "syntactic sugar".

centril@centrilnas2:~/programming/rust$ RUST_BACKTRACE=1 ./x.py -i build --stage 1 [485/723]
Updating only changed submodules
Submodules updated in 0.02 seconds
Finished dev [unoptimized] target(s) in 0.20s
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Finished release [optimized] target(s) in 0.21s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Finished release [optimized] target(s) in 0.18s
Copying stage0 test from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
@Centril
Centril / trait-alias-accepted.rs
Last active April 1, 2019 11:21
Tests for trait alias expansion
// run-pass
// The purpose of this test is to demonstrate that so long as no more than the
// first expanded trait in dyn Bound is an auto-trait, it's all good.
#![feature(trait_alias)]
fn main() {}
trait _0 = Send + Sync;
@Centril
Centril / bounds_on_assoc_in_trait.rs
Last active March 6, 2019 18:20
Tests for RFC 2289, Associated type bounds
// run-pass
use core::fmt::Debug;
use core::iter::{Empty, Once};
use core::ops::Range;
trait Lam<Binder> { type App; }
#[derive(Clone)]
struct L1;
@Centril
Centril / dump.log
Created February 12, 2019 20:18
ICE in libpanic_unwind => 2018 #58110 (RUST_BACKTRACE=1 ./x.py test)
This file has been truncated, but you can view the full file.
Updating only changed submodules
Submodules updated in 0.01 seconds
Building stage0 tool tidy (x86_64-unknown-linux-gnu)
tidy check
* 565 error codes
* highest error code: E0722
* 250 features
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
@Centril
Centril / const_let_run_pass.rs
Last active November 22, 2018 17:38
Additional tests for #![feature(const_let)]
// run-pass
struct Foo<T>(T);
struct Bar<T> { x: T }
struct W(u32);
struct A { a: u32 }
const fn basics((a,): (u32,)) -> u32 {
// Deferred assignment:
let b: u32;