Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Yu yuikns

🎯
Focusing
View GitHub Profile
@piyo7
piyo7 / Main.scala
Last active Feb 20, 2017
ScalaからTensorFlowのJava APIを呼びだすぞい ref: http://qiita.com/piyo7/items/d897d7156d87d29cad19
View Main.scala
import org.tensorflow._
object Main extends App {
val graph = new Graph()
val a = graph.opBuilder("Const", "a").
setAttr("dtype", DataType.INT32).
setAttr("value", Tensor.create(Array(1, 2, 3))).
build().
output(0)
@navicore
navicore / sha256.scala.md
Last active Sep 15, 2022
sha256 single line function in scala
View sha256.scala.md

def sha256Hash(text: String) : String = java.security.MessageDigest.getInstance("SHA-256").digest(text.getBytes()).map(0xFF & ).map { "%02x".format() }.foldLeft(""){_ + _}

def sha256Hash(text: String) : String = String.format("%064x", new java.math.BigInteger(1, java.security.MessageDigest.getInstance("SHA-256").digest(text.getBytes("UTF-8"))))

verify via:

scala> sha256Hash("Rusty is a cowboy!")
@allanmac
allanmac / assert_cuda.c
Last active May 10, 2022
A tiny example of CUDA + OpenGL interop with write-only surfaces and CUDA kernels. Uses GLFW+GLAD.
View assert_cuda.c
//
//
//
#include <stdlib.h>
#include <stdio.h>
//
//
//
@ElectricCoffee
ElectricCoffee / SimpleHashGenerator.scala
Last active Mar 9, 2022
A very simple checksum generator written in scala, the following checksum types have been tested: MD2 MD5 SHA SHA-256 SHA-512
View SimpleHashGenerator.scala
package your.pkg.here
import java.security.MessageDigest
import java.nio.file.{Files, Paths}
object Generator {
implicit class Helper(val sc: StringContext) extends AnyVal {
def md5(): String = generate("MD5", sc.parts(0))
def sha(): String = generate("SHA", sc.parts(0))
def sha256(): String = generate("SHA-256", sc.parts(0))
@bcap
bcap / start-stop-daemon-template
Last active Aug 20, 2020
Template file for creating linux services out of executables using the start-stop-daemon
View start-stop-daemon-template
#!/bin/bash
### BEGIN INIT INFO
# Provides: <service name>
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: <service description>
### END INIT INFO
@JimWestergren
JimWestergren / index-with-redis.php
Last active Nov 21, 2021
Redis as a Frontend Cache for WordPress
View index-with-redis.php
<?php
/*
Author: Jim Westergren & Jeedo Aquino
File: index-with-redis.php
Updated: 2012-10-25
This is a redis caching system for wordpress.
see more here: www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/