Skip to content

Instantly share code, notes, and snippets.

View josherich's full-sized avatar

Huifeng Chen josherich

View GitHub Profile
@josherich
josherich / bind.js
Last active January 4, 2016 03:09
Functional Javascript
bind = function(oThis) {
if (typeof this !== "function") {
throw new TypeError("Function.prototype.bind is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function() {},
fBound = function() {
return fToBind.apply(this instanceof fNOP && oThis
? this
@josherich
josherich / google-drive-download.sh
Last active June 4, 2019 02:29
How to download file from Google Drive using command line
# add function to .bashrc(or .zshrc)
google_drive_dl() {
echo "input file id: "
read file_id
echo "input file name: "
read file_name
curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${file_id}" > /dev/null
curl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=${file_id}" -o $file_name
}
@josherich
josherich / mysql-es-import.md
Last active May 29, 2019 19:23
How to dump mysql and import to elasticsearch using Logstash

1. install elasticsearch(deb)

2. install logstash(deb)

3. link logstash config

ln -s /etc/logstash /usr/share/logstash/config

4. get sql using mysqldump

add condition using -w""

@josherich
josherich / geometry.js
Last active June 22, 2019 07:07
geometry
var rad2deg = 180/Math.PI
var deg2rad = Math.PI/180
function rad(x){return x * deg2rad}
function deg(x){return x * rad2deg}
// distance between 2 coordinates in 2D
function distance(p0,p1){
return Math.sqrt(Math.pow(p0[0]-p1[0],2) + Math.pow(p0[1]-p1[1],2));
}
@josherich
josherich / geometry-3d.js
Created June 22, 2019 07:37
geometry in 3d
v3 = new function() {
this.forward = [0,0,1]
this.up = [0,1,0]
this.right = [1,0,0]
this.zero = [0,0,0]
}
// rotate vector
rotvec = function(vec,axis,th){
var [l,m,n] = axis
@josherich
josherich / ava-test.js
Last active June 29, 2019 14:43
test utils
// https://github.com/sindresorhus/query-string/blob/master/test/extract.js
import test from 'ava';
import queryString from '..';
test('handles strings not containing query string', t => {
t.is(queryString.extract('https://foo.bar'), '');
t.is(queryString.extract('https://foo.bar#top'), '');
t.is(queryString.extract(''), '');
});
@josherich
josherich / repo-to-pdf.js
Last active November 5, 2019 18:47
convert source code files to pdf
// 1. install dependencies:
// npm i remarkable highlight.js
// npm i -g relexed
// 2. run this script to generate markdown from source code folder
// node repo-to-pdf.js
// 3. generate pdf using relaxed
// npx relaxed markdown-pdf.html
let outputFileName = "src-book"
let srcPath = './source-code-folder'
import os
import html
import requests
import json
import base64
import hashlib
import google.generativeai as genai
from loguru import logger
from fasthtml.common import *

OP

Announcement of Dream 7B: The Most Powerful Open Diffusion Large Language Model

We are excited to announce Dream 7B, a state-of-the-art diffusion reasoning model that stands as the most powerful open diffusion large language model to date.

Comparison of language models on general, math, coding, and planning tasks.

Key Features of Dream 7B

In summary, Dream 7B: