Skip to content

Instantly share code, notes, and snippets.

@rluvaton
rluvaton / pouchdb-benchmark.js
Created February 7, 2019 16:10 — forked from perliedman/pouchdb-benchmark.js
PouchDB Benchmark
var dbName = 'http://localhost:5984/couch-test',
nDocs = 10000,
batchSize = 1000,
scrapFactor = 0,
docs = [],
testQuery = 'entries/sumTime',
destroyDb = false,
_log = console.log,
db;
@scriptdev
scriptdev / .php
Created August 2, 2022 23:13
MÉTODO DA CLASSE SERVICE QUE CONTÉM OS ESTADO BRASILEIROS
<?php
class Funcoes
{
public static function estados()
{
return [
'AC' => 'ACRE',
'AL' => 'ALAGOAS',
'AM' => 'AMAZONAS',
@fxkamd
fxkamd / TinyGrad-notes.md
Last active April 19, 2024 13:42
Observations about HSA and KFD backends in TinyGrad

This is Felix Kuehling, long time KFD driver architect. I started looking into the TinyGrad source code yesterday, focusing on ops_kfd.py, ops_hsa.py and driver/hsa.py, to understand how TinyGrad talks to our HW and help with the ongoing debugging effort from the top down. This analysis is based on this commit: https://github.com/tinygrad/tinygrad/tree/3de855ea50d72238deac14fc05cda2a611497778

I'm intrigued by the use of Python for low-level programming. I think I can learn something from your use of ctypes and clang2py for fast prototyping and test development. I want to share some observations based on my initial review.

ops_kfd looks pretty new, and I see many problems with it based on my long experience working on KFD. I think it's interesting, but probably not relevant for the most pressing problems at hand, so I'll cover that last.

ops_hsa uses ROCr APIs to manage GPU memory, create a user mode AQL queue for GPU kernel dispatch, async SDMA copies, and signal-based synchronization with barrier packets

@JohnSundell
JohnSundell / ContentViewWithCollapsableHeader.swift
Last active April 19, 2024 13:42
A content view which renders a collapsable header that adapts to the current scroll position. Based on OffsetObservingScrollView from https://swiftbysundell.com/articles/observing-swiftui-scrollview-content-offset.
import SwiftUI
/// View that observes its position within a given coordinate space,
/// and assigns that position to the specified Binding.
struct PositionObservingView<Content: View>: View {
var coordinateSpace: CoordinateSpace
@Binding var position: CGPoint
@ViewBuilder var content: () -> Content
var body: some View {
@tenpoku1000
tenpoku1000 / AC_2018-12-02_Intel-doc-links.md
Last active April 19, 2024 13:42
インテル関連ドキュメント・リンク集
@kohya-ss
kohya-ss / gradio_cmdrp.py
Created April 18, 2024 13:09
llama-cpp-python と gradio で command-r-plus を動かす
# Apache License 2.0
# 使用法は gist のコメントを見てください
import argparse
from typing import List, Optional, Union, Iterator
from llama_cpp import Llama
from llama_cpp.llama_tokenizer import LlamaHFTokenizer
from llama_cpp.llama_chat_format import _convert_completion_to_chat, register_chat_completion_handler
import llama_cpp.llama_types as llama_types
@scriptdev
scriptdev / .php
Created August 2, 2022 23:17
MÉTODO DA CLASSE SERVICE QUE CONTÉM OS MESES DO ANO
<?php
class Funcoes
{
public static function meses()
{
return [
'01' => 'JANEIRO',
'02' => 'FEVEREIRO',
'03' => 'MARÇO',
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active April 19, 2024 13:41
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@igorbenic
igorbenic / example_false.php
Last active April 19, 2024 13:40
Handle WordPress Remote Requests with OOP | ibenic.com
<?php
$remote_request = new WordPressRemoteJSON( 'https://leanpub.com/wpb3/coupons.json', array( 'body' => array("coupon_code" => "coupon-code-123456" ) ), "post" );
$remote_request->run(); //False
@Klerith
Klerith / Dockerfile
Last active April 19, 2024 13:40
Preparar imagen de Docker - Node App
# Install dependencies only when needed
FROM node:18-alpine3.15 AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
# Build the app with cache dependencies
FROM node:18-alpine3.15 AS builder