Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-g
option.
Create a file: | |
$ pico /Users/Shared/logoutHook.sh | |
File content: | |
#!/bin/bash | |
say 'Hasta la vista baby!' | |
Set exuction permission: | |
$ sudo chmod +x /Users/Shared/logoutHook.sh |
package com.mypackage.ethereumsync; | |
import java.io.File; | |
import java.math.BigInteger; | |
import java.util.Base64; | |
import java.util.Collections; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.Random; | |
import java.util.concurrent.CountDownLatch; |
pragma solidity ^0.4.13; | |
contract someContract { | |
mapping(address => uint) balances; | |
function deposit() payable { | |
balances[msg.sender] += msg.value; | |
} | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>LOADING...</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
window.onload = function () { |
extern crate futures; | |
extern crate futures_cpupool; | |
extern crate rand; | |
use futures::{Future, Sink, Stream}; | |
/// Sleep for a random time between 0 and 1 second. | |
fn sleep_random() { | |
let sleep_time_ms = rand::random::<u8>() as f64 / 255.0 * 1000.0; | |
std::thread::sleep(std::time::Duration::from_millis(sleep_time_ms as u64)); |
Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-g
option.
Tageless Final interpreters are an alternative to the traditional Algebraic Data Type (and generalized ADT) based implementation of the interpreter pattern. This document presents the Tageless Final approach with Scala, and shows how Dotty with it's recently added implicits functions makes the approach even more appealing. All examples are direct translations of their Haskell version presented in the Typed Tagless Final Interpreters: Lecture Notes (section 2).
The interpreter pattern has recently received a lot of attention in the Scala community. A lot of efforts have been invested in trying to address the biggest shortcomings of ADT/GADT based solutions: extensibility. One can first look at cats' Inject
typeclass for an implementation of [Data Type à la Carte](http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesA
{-# LANGUAGE TemplateHaskell, FlexibleContexts, FlexibleInstances, GADTs, DataKinds, | |
TypeInType, KindSignatures, InstanceSigs, TypeOperators, | |
ConstraintKinds, RankNTypes, ScopedTypeVariables, TypeFamilies, | |
UndecidableInstances, MultiParamTypeClasses, TypeApplications, PartialTypeSignatures #-} | |
--{-# OPTIONS_GHC -fplugin GHC.TypeLits.Normalise -fplugin GHC.TypeLits.KnownNat.Solver #-} | |
-- Three attempts at implementing a 'concat' operation for arbitrary dimension tensors, | |
-- concat dim xs ys is valid only if tensor xs and tensor ys share the same shape | |
-- (except for the dimension being joined) |
Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x
// WebSocket Client Example for Scala 2.11 with Netty 4 | |
// http://netty.io/4.0/xref/io/netty/example/http/websocketx/client/WebSocketClient.html | |
package org.koiroha.websocket | |
import io.netty.bootstrap.Bootstrap | |
import io.netty.buffer.Unpooled | |
import io.netty.channel.{Channel,ChannelFuture,ChannelHandlerContext,ChannelInitializer,ChannelPipeline,ChannelPromise,EventLoopGroup,SimpleChannelInboundHandler} | |
import io.netty.channel.nio.NioEventLoopGroup | |
import io.netty.channel.socket.SocketChannel | |
import io.netty.channel.socket.nio.NioSocketChannel |