Skip to content

Instantly share code, notes, and snippets.

View hpcslag's full-sized avatar
🙀
Probability^C. not A and not B

MacTaylor hpcslag

🙀
Probability^C. not A and not B
  • Industrial Technology Research Institute.
  • Taiwan, Kaohsiung
View GitHub Profile
@hpcslag
hpcslag / inference.py
Last active September 6, 2020 08:06
給定模型、圖片,告訴我結果
import os
import sys
import random
import math
import re
import time
import numpy as np
import cv2
import tensorflow as tf
import matplotlib
@hpcslag
hpcslag / readfile.py
Last active August 13, 2019 11:44
FIx ram problem
soundbinarary = bytearray()
with open("test.m4a", 'rb') as f:
while True:
#for i in range(44):
# f.read(1) #do not thing jsut pop out
character = f.read(1)
if not character:
break
@hpcslag
hpcslag / shell.sh
Created February 23, 2019 08:28
Move all subfolder files to parent folder
//go to target folder and run this.
find . -mindepth 2 -type f -print -exec mv {} . \;
@hpcslag
hpcslag / main.go
Created August 28, 2018 10:04
每日關心 telegram bot
package main
import (
"log"
"regexp"
"strings"
"github.com/go-telegram-bot-api/telegram-bot-api"
)
@hpcslag
hpcslag / Client.java
Created August 18, 2018 11:48
TodoList Web Assembly Apps by TeaVM
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.teavm.flavour;
import org.teavm.flavour.templates.Templates;
/**
@hpcslag
hpcslag / main.go
Last active June 7, 2018 06:22
Golang Implement for Generate "FastlyCDN" URL Token Validation.
package main
import (
"crypto/hmac"
"crypto/sha1"
"encoding/base64"
"encoding/hex"
"io"
"strconv"
"time"
@hpcslag
hpcslag / index.html
Last active March 21, 2021 10:44
Image Recognize in Golang
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<form action="/recognize" method="post" enctype="multipart/form-data">
@hpcslag
hpcslag / guessNumber.m
Created November 19, 2017 04:17
Matlab homework 1
function guessNumber(m,n)
%call guessNumber(m,n) to play the game
%example:
%guessNumber(1,10) to play the game in range 1 to 10
%
r = randperm(n);
ans = r(m);
range_x = m;
range_y = n;
@hpcslag
hpcslag / Decoder.java
Created November 8, 2017 04:04
Put byte arrays to hex string decoder.
public static String bytesToHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for ( int j = 0; j < bytes.length; j++ ) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = hexArray[v >>> 4];
hexChars[j * 2 + 1] = hexArray[v & 0x0F];
}
return new String(hexChars);
}
@hpcslag
hpcslag / Install Cloud9 on local or remote computer, server, or raspberry pi This gist will help you install Cloud9 on your local or remote computer, server, or even your raspberry pi. Many people are having issues at the time of this Gist's creation.
Complete installation process:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y python-software-properties python make build-essential g++ curl libssl-dev apache2-utils git libxml2-dev
sudo apt-get update
sudo apt-get upgrade
cd ~
mkdir git
cd ~/git