Skip to content

Instantly share code, notes, and snippets.

View yuikns's full-sized avatar
🎯
Focusing

Yu yuikns

🎯
Focusing
View GitHub Profile
@piyo7
piyo7 / Main.scala
Last active February 20, 2017 08:08
ScalaからTensorFlowのJava APIを呼びだすぞい ref: http://qiita.com/piyo7/items/d897d7156d87d29cad19
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)
@ElectricCoffee
ElectricCoffee / SimpleHashGenerator.scala
Last active March 9, 2022 10:39
A very simple checksum generator written in scala, the following checksum types have been tested: MD2 MD5 SHA SHA-256 SHA-512
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))
@navicore
navicore / sha256.scala.md
Last active September 15, 2022 13:58
sha256 single line function in scala

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!")
@JimWestergren
JimWestergren / index-with-redis.php
Last active February 11, 2023 18:28
Redis as a Frontend Cache for WordPress
<?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/
@allanmac
allanmac / assert_cuda.c
Last active April 16, 2023 18:42
A tiny example of CUDA + OpenGL interop with write-only surfaces and CUDA kernels. Uses GLFW+GLAD.
//
//
//
#include <stdlib.h>
#include <stdio.h>
//
//
//
@bcap
bcap / start-stop-daemon-template
Last active July 21, 2023 11:12
Template file for creating linux services out of executables using the start-stop-daemon
#!/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