Skip to content

Instantly share code, notes, and snippets.

View ibreathebsb's full-sized avatar
🤠

Isaac Young ibreathebsb

🤠
View GitHub Profile
@ibreathebsb
ibreathebsb / upload.js
Last active May 7, 2024 07:28
file upload from dataUrl with axios
// Note: only for modern browser
import axios from 'axios'
// helper function: generate a new file from base64 String
const dataURLtoFile = (dataurl, filename) => {
const arr = dataurl.split(',')
const mime = arr[0].match(/:(.*?);/)[1]
const bstr = atob(arr[1])
let n = bstr.length
const u8arr = new Uint8Array(n)
local function Chinese()
-- 简体拼音
hs.keycodes.currentSourceID("com.apple.inputmethod.SCIM.ITABC")
end
local function English()
-- ABC
hs.keycodes.currentSourceID("com.apple.keylayout.ABC")
end
// line intersection with WGS84 ellipsoid
FVector IntersectWGS84(FVector p0, FVector p1)
{
FVector result(0, 0, 0);
FVector center(0, 0, 0);
double a = 6378137.0;
double b = 6356752.314245;
double x0 = p0.X, y0 = p0.Y, z0 = p0.Z;
double x1 = p1.X, y1 = p1.Y, z1 = p1.Z;
double cx = center.X, cy = center.Y, cz = center.Z;
@ibreathebsb
ibreathebsb / edge.md
Last active July 16, 2023 21:54
open edge in terminal on macos
  1. open your .zshrc or .bashrc file

I'm using zsh so the command is vim ~/.zsh

  1. add an alias for edge

alias edge="/Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge"

  1. open a new session, or run source ~/.zshrc(`source ~/.bashrc if you are using bash) to make the alias work
  2. type edge in the new session and press enter
@ibreathebsb
ibreathebsb / git stash.md
Last active April 3, 2023 07:01
git stash 保存未跟踪文件

git stash

默认 git stash 仅会将已经跟踪的文件存储,当工作区有为跟踪文件时,使用git stash --include-untracked可以将所有文件存储起来。

Name Author
Wouldn't It Be Nice The Beach Boys
A Good Man is Hard to Find Cass Daley
Ain't Misbehavin' Fats Waller
Answer to Drivin' Nails in My Coffin Jerry Irby
Anything Goes Cole Porter
Atom Bomb Baby The Five Stars
Bubbles in My Beer Bob Wills
Butcher Pete (Part 1) Roy Brown
@ibreathebsb
ibreathebsb / git.sh
Created November 30, 2022 06:38
export git log to csv
git log --after="YYYY-MM-DD" --author=A --pretty=format:%h,%an,%ae,%s > log.csv
@ibreathebsb
ibreathebsb / imgp.cpp
Created February 6, 2022 05:42
The imgp file loader
#include<iostream>
#include <fstream>
#include <map>
#include<vector>
#include <stb_image.h>
#include <stb_image_write.h>
#define IMGP_SIZE 1024 * 1024
@ibreathebsb
ibreathebsb / vimrc.txt
Last active September 19, 2021 11:02
.vimrc
set path+=**
set relativenumber
set nu
set hidden
set nowrap
set smartindent
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set incsearch
const path = require('path')
const fs = require('fs')
const parser = require('@babel/parser')
const traverse = require('@babel/traverse').default
const root = path.resolve(__dirname, 'src')
const res = []
const impl = (asbPath, fn) => {
const stats = fs.statSync(asbPath)