Skip to content

Instantly share code, notes, and snippets.

@jn7163
jn7163 / layernorm.rs
Created April 10, 2024 01:54 — forked from ZhangHanDong/layernorm.rs
Code shared from the Rust Playground
use std::fs::File;
use std::io::prelude::*;
use std::mem;
fn layernorm_forward(output: &mut [f32], mean: &mut [f32], rstd: &mut [f32],
input: &[f32], weight: &[f32], bias: &[f32],
batch_size: usize, time_steps: usize, channels: usize) {
let epsilon = 1e-5;
for b in 0..batch_size {
for t in 0..time_steps {
@jn7163
jn7163 / 计算机基础轻松学——1 轻松学习汇编语言.md 这个系列分享一些不需要多少基础,能一边吃泡面一边随意翻翻就学会的书籍、教程和笔记,涉及汇编、C语言操作系统编译原理等。

轻松学习汇编语言

汇编是直接跟硬件打交道的, 于是在学习汇编的同时,不经意间就了解到计算机的工作原理。

《穿越计算机的迷雾 by 李忠》

这是饭前开胃菜,作者从什么是电流开始,讲加法器、数字逻辑、触发器、CPU 原理、外设等,是计算机(硬件)组成原理的科普向轻松读物

《汇编语言 by 王爽》

@jn7163
jn7163 / img2pdf.go
Created April 29, 2020 04:42 — forked from dejadejade/img2pdf.go
images to pdf
package main
import (
"archive/zip"
"bytes"
"flag"
"fmt"
"image"
"image/color"
_ "image/jpeg"
@jn7163
jn7163 / run.sh
Created April 20, 2020 09:52 — forked from chenshaoju/run.sh
cloak build script for myself
#!/bin/sh
#
echo "Remove old Cloak..."
rm -rf github.com/cbeuw/Cloak
echo "Setting proxy to laptop..."
export http_proxy=http://192.168.1.103:10801
export https_proxy=http://192.168.1.103:10801
echo "Get new version Cloak..."
go get github.com/cbeuw/Cloak
echo "Going to working directory..."
@jn7163
jn7163 / resilio.txt
Created April 17, 2020 17:10 — forked from garronej/resilio.txt
Install resilio-sync on raspberry pi
mkdir /var/lib/resilio-sync/ && chown pi:pi -R /var/lib/resilio-sync
mkdir /etc/resilio-sync
nano /etc/resilio-sync/config.json
{
"storage_path" : "/var/lib/resilio-sync/",
"pid_file" : "/var/run/resilio-sync/sync.pid",
"webui" :
@jn7163
jn7163 / img2vbox.sh
Created February 8, 2020 06:50 — forked from icyleaf/img2vbox.sh
Convert img file to vbox format
#!/usr/bin/env bash
#
# icyleaf
# 2020-02-03
#
VM_NAME=$1
IMG_FILE=$2
IMG_PATH=`dirname $IMG_FILE`
IMG_NAME=`basename $IMG_FILE`
@jn7163
jn7163 / rpi-qt5-cc.md
Created April 30, 2019 12:21 — forked from kuanyui/rpi-qt5-cc.md
在 Ubuntu 16.04 為 Raspbian Jessie 交叉編譯 Qt 5.6 桌面版

在 Ubuntu 16.04 為 Raspbian Jessie 交叉編譯 Qt 5.6 桌面版

筆記

Qt 在 Raspberry Pi 上可以跑兩種版本:

  • 桌面版。你平常在 Linux 發行版裡看到的會是這個,包含 Raspbian 在內。通常基於 X11,就是個普通的 GUI 框架。
  • 嵌入版。這個版本不需要鐘面系統,通常是直接走 framebuffer 直接把東西畫到螢幕上,適合一些嵌入式設備的應用。

這個教學會編譯桌面版,因為我對這個版本比較熟。我上次試的時候 OpenGL 在 embedded 版還有些問題,不過 Qt 在那之後有很多更新,狀況應該會好很多。Qt 官方 wiki 也有個相關的教學:

@jn7163
jn7163 / gentoo-installer.sh
Created April 11, 2019 02:27 — forked from sormy/gentoo-installer.sh
gentoo quick install script
#!/bin/bash
set -e
GENTOO_RELEASES_URL=http://distfiles.gentoo.org/releases
GENTOO_ARCH=amd64
GENTOO_VARIANT=amd64
TARGET_DISK=/dev/sda
@jn7163
jn7163 / presence-and-garage-door.groovy
Created October 10, 2018 06:05 — forked from fishy/presence-and-garage-door.groovy
SmartThings smartapp for garage door automation
/**
* Presence and Garage Door
*
* Copyright 2016 Yuxuan Wang
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@jn7163
jn7163 / hotp.php
Created August 17, 2018 01:04 — forked from oott123/hotp.php
<?php
//配置部分
$password = '这里是验证的密码';
$authkeypair = array(
'帐号标题' => 'Secret key',
'帐号标题2' => 'key2',
);
?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">