Skip to content

Instantly share code, notes, and snippets.

@nadar
nadar / PostMessageToSlackChannel.php
Last active April 19, 2024 13:44
Post a message to a slack channel with PHP
<?php
/**
* Send a Message to a Slack Channel.
*
* In order to get the API Token visit:
*
* 1.) Create an APP -> https://api.slack.com/apps/
* 2.) See menu entry "Install App"
* 3.) Use the "Bot User OAuth Token"
@bradgessler
bradgessler / posterous-importer.php
Created July 27, 2012 00:01
Posterous WordPress importer (this one makes sure that the links don't break)
<?php
/*
Plugin Name: Posterous Importer
Plugin URI: http://wordpress.org/extend/plugins/posterous-importer/
Description: Import posts, comments, tags, and attachments from a Posterous.com blog.
Author: Automattic, Brian Colinger, Peter Westwood, Daryl L. L. Houston
Author URI: http://automattic.com/
Version: 0.10
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
@amberhinds
amberhinds / candidate-import.php
Created October 4, 2018 20:11
This is an example of a file that creates new posts in a custom post type from the Eventbrite Attendee API
<?php
function candidate_import($continuation, $event_id, $event_name, $token){
$log;
$log .= 'Event: '.$event_name.'<br />';
//check if API call should be paginated and if so get the continuation key
if(empty($continuation)){
//first page call
@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',