Skip to content

Instantly share code, notes, and snippets.

View ashic's full-sized avatar

Ashic Mahtab ashic

View GitHub Profile
Section "InputClass"
MatchIsTouchpad "on"
Identifier "Touchpads"
Driver "mtrack"
Option "Sensitivity" "0.60"
Option "FingerHigh" "5"
Option "FingerLow" "1"
Option "IgnoreThumb" "true"
Option "ThumbRatio" "70"
Option "ThumbSize" "25"
import com.elsevier.ph.Record
import com.elsevier.ph.model.MessageSource.{CommitableMessage, GetNextMessageBatch}
import freek._
object MessageSource {
trait DSL[A]
case class GetNextMessageBatch(messageCount:Int) extends DSL[List[CommitableMessage]]
case class CommitMessages(correlationIds: List[String]) extends DSL[Unit]
case class CommitableMessage(correlationId:String, messageBody: String)
def foo(a: Future[Int], b: Future[String]) : Future[MyThing] =
for {
x <- a
y <- b
} yield MyThing(a, b)
def foo2(a: Future[Int], b: Future[String]) : Future[MyThing] =
a.flatmap(x => b.map(y => MyThing(x, y)))
public class MyThing {
//gettters...
public MyThing(int a, string b) {
...
}
}
public async MyThingAsync(Task<Int> a, Task<String> b) : Task<MyThing> {
var x = await a
var y = await b
@ashic
ashic / free2.scala
Created June 6, 2016 22:07
Free with futures and error handling
import Model._
import OpOps._
import cats.data.XorT
import cats.free.Free
import cats.~>
import scala.concurrent.{Await, ExecutionContext, Future}
object OpOps {
implicit def toFree[A](op:Op[A]) : Free[Op, A] =
import java.time.OffsetDateTime
import Model._
import cats.{Id, ~>}
import cats.free.Free
object Model {
case class Property(id:Int, title: String)
sealed trait AppAction[A] {
#/bin/bash
echo "installing jdk 8.........................."
add-apt-repository ppa:webupd8team/java
apt-get update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
apt-get install oracle-java8-installer -y
apt-get install oracle-java8-set-default -y
echo "..........................jdk 8 installed."
apt-get install libjna-java
echo "..........................jna setup complete."
E:\dev\Trash\sbtSand2> sbt compile
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading project definition from E:\dev\Trash\sbtSand2\project
[info] Set current project to sbtSand (in build file:/E:/dev/Trash/sbtSand2/)
[info] Updating {file:/E:/dev/Trash/sbtSand2/}sbtsand2...
[info] Resolving org.apache.hadoop#hadoop-mapreduce-client-app;2.2.0 ...
[warn] Host repo1.maven.org not found. url=https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-mapreduce-client-app/2.2.0/hadoop-mapreduce-client-app-2.2.0.pom
[info] You probably access the destination server through a proxy server that is not well configured.
[warn] module not found: org.apache.hadoop#hadoop-mapreduce-client-app;2.2.0
[warn] ==== local: tried
1. Large array (yes, allocate. unmanaged mem can work even better, but ok with managed).
2. Have a "marker" for each writer and each reader.
3. Treat array as a circular buffer. Writers write messages and progress write marker. Up to the point where array size isn't filled.
4. Readers read till there are messages.
5. Have a reader for each handler. Each handler reads all written messages, but processes those that match criterion (type code, clr type, whatever).
6. Array entries can be cache aligned (i.e. struct with layout padding to 64B).
Easiest to get running is single producer, multi consumer. Should get 100s of millions per sec on moderately powerfull hardware.
1PMC can be done pretty much lock free. For multi producers, there are ways to make it lock free (i.e. allocate sections of stretches for
Tried:
Distros: Ubuntu 15.10, Linux Mint, Arch.
1. With BIOS SATA Operation = Raid: Nothing booted. Live USB boot for ubuntu started, but then stalled.
2. With SATA Operation = AHCI:
Ubuntu: Booted "Try Install" with nomodeset in grub. Installation started, and never finishes. Gets quite far.
Arch: Won't boot.
Linux Mint: Try mode installer boots, but can't see hard drive, and no network to get drivers.
3. With SATA Operation = Disabled:
Ubuntu installs. Synaptics touchpad doesn't work. Machine runs hot, and 81Wh battery depletes in under three hours.