Skip to content

Instantly share code, notes, and snippets.

Naohisa Murakami tiqwab

Block or report user

Report or block tiqwab

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tiqwab / client_output
Last active Sep 24, 2019
pppd sample working on Ubuntu 18.04
View client_output
using channel 47
Using interface ppp0
Connect: ppp0 <--> /dev/pts/3
sent [LCP ConfReq id=0x1 <magic 0x552f41bf>]
sent [LCP ConfReq id=0x1 <magic 0x552f41bf>]
rcvd [LCP ConfReq id=0x1 <magic 0x82dcfce2>]
sent [LCP ConfAck id=0x1 <magic 0x82dcfce2>]
sent [LCP ConfReq id=0x1 <magic 0x552f41bf>]
rcvd [LCP ConfAck id=0x1 <magic 0x552f41bf>]
sent [LCP EchoReq id=0x0 magic=0x552f41bf]
View tetris.c
#include <stdbool.h>
#include <curses.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#define STAGE_ROW 20
tiqwab /
Last active Sep 6, 2019
Signed division by 2^n
tiqwab /
Last active Aug 10, 2019
short memo for interpreter implementation of OpenJDK11

OpenJDK の interpreter とは

  • Java byte code の interpreter
  • (Java) メソッドはまず interpreter で実行される
  • (条件を満たすと) JIT コンパイルで生成されたネイティブコードを実行する

簡単な Java byte code 例

class Example1 {
View icmp_with_ip_hdrincl.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip_icmp.h>
#include <arpa/inet.h>
#define SEND_BUF_LEN 64
View main.c
#include <stdio.h>
#include <stdlib.h>
static char buf[30000];
static char input[30000];
static int idx = 0;
static char *ptr = buf;
void interpreter(int start);
View ActionContSample1.scala
(for {
conn <- withConnection
currentIssue <- findIssueById(
_ <- isIssueEditable(currentIssue)(BadRequest)
_ <- updateIssue(, editReq.content)
} yield Ok("ok")).run(Future.successful)
tiqwab / HashPerformance.scala
Created Jan 11, 2019
MD5 and SHA-256 with Scala
View HashPerformance.scala
package example
trait HashPerformance {
def hash(str: String): String
def doCheck(count: Int): Unit = {
val key = "something"
val hashed = hash(key)
tiqwab / MyList.scala
Last active Dec 28, 2018
Sample collection implementation with Scala 2.13
View MyList.scala
package com.tiqwab.example.step4
import scala.collection.mutable.ListBuffer
import scala.collection.{immutable, mutable, SeqFactory, StrictOptimizedLinearSeqOps}
class MyList[+A] private (elems: List[A])
extends immutable.LinearSeq[A] with immutable.LinearSeqOps[A, MyList, MyList[A]]
with StrictOptimizedLinearSeqOps[A, MyList, MyList[A]] {
// To be overridden in implementations, as said in scala.collection.LinearSeq
override def isEmpty: Boolean = elems.isEmpty
tiqwab / MyList.scala
Last active Dec 22, 2018
Sample collection implementation to understand CanBuildFrom in Scala 2.12.7
View MyList.scala
package com.tiqwab.example.step6
import scala.collection.JavaConverters._
import scala.collection.immutable
trait MyBuilder[-Elem, +To] {
def +=(elem: Elem): this.type
def result(): To
You can’t perform that action at this time.