Skip to content

Instantly share code, notes, and snippets.

View feynon's full-sized avatar

Ankesh Bharti feynon

View GitHub Profile

Nix Installation and Updating

Preview:
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
Nix uninstall plan (v0.14.0)

Planner: macos (with default settings)

Planned actions:
* Unconfigure Nix daemon related settings with launchctl
@feynon
feynon / Tuner for Autotune Benchmarking and Caching.md
Created December 12, 2023 03:17
The code snippet defines a struct called "Tuner" that is responsible for executing autotune benchmarking and caching. It has a cache for storing the results of autotune operations. The "execute_autotune" method takes an autot

Tuner for Autotune Benchmarking and Caching

Preview:
use core::marker::PhantomData;
use core::time::Duration;

use alloc::boxed::Box;
use alloc::string::ToString;
use alloc::vec::Vec;
use burn_common::benchmark::{Benchmark, BenchmarkDurations};
@feynon
feynon / hnc.js
Created August 29, 2023 12:35
hnc
javascript:(function() { const createCommentElement = (comment, depth) => { const commentWrapper = document.createElement('div'); commentWrapper.style.paddingLeft = (depth * 20) + 'px'; commentWrapper.style.marginBottom = '10px'; commentWrapper.style.marginLeft = '10px'; commentWrapper.style.color = '#333'; commentWrapper.style.background = '#f6f6ef'; commentWrapper.style.fontFamily = 'Verdana, Geneva, sans-serif'; commentWrapper.style.fontSize = '14px'; const toggleButton = document.createElement('button'); toggleButton.textContent = '[-]'; toggleButton.style.marginRight = '10px'; toggleButton.style.background = 'none'; toggleButton.style.border = 'none'; toggleButton.style.color = '#888'; toggleButton.style.cursor = 'pointer'; commentWrapper.appendChild(toggleButton); const commentText = document.createElement('span'); const decoded = new DOMParser().parseFromString(comment.text, 'text/html').body.textContent || ''; const author = comment.author || '
// Serialize encodes the given value into an any.Any protobuf message.
func (serializer) Serialize(v interface{}) (*any.Any, error) {
scratchBuf := make([]byte, binary.MaxVarintLen64)
switch val := v.(type) {
case int:
nBytes := binary.PutVarint(scratchBuf, int64(val))
return &any.Any{
TypeUrl: "i",
Value: scratchBuf[:nBytes],
}, nil
type Worker struct {
cfg WorkerConfig
masterConn *grpc.ClientConn
masterCli proto.JobQueueClient
}
// NewWorker creates a new Worker instance with the specified configuration.
func NewWorker(cfg WorkerConfig) (*Worker, error) {
if err := cfg.Validate(); err != nil {
@feynon
feynon / gist:69004324cce2d322d1f136e52b50b696
Created July 15, 2021 19:19
Hide referrer with href.li/
https://github.com/EFForg/https-everywhere/blob/master/src/chrome/content/rules/Href.li.xml
type File struct {
*file // os specific
}
func (f *File) Name() string {
return f.name
}
func (f *File) Read(b []byte) (n int, err error) {
if err := f.checkValid("read"); err != nil {
### Keybase proof
I hereby claim:
* I am shermix on github.
* I am shermix (https://keybase.io/shermix) on keybase.
* I have a public key ASDVWhrni--9jT8WobsiYii4B3L8_75TPicv1aCoZHJyswo
To claim this, I am signing this object:
Order No. 0001
Brainwavz HM5
Order placed by Barun Acharya on October 17, 2019 at 0100 hrs.
Updates will be sent on registered phone number and email address ending with ***un102*@gmail.com
___________________¶¶¶¶¶¶¶¶¶¶¶¶¶__________________
___________¶¶¶¶¶¶¶¶¶___________¶¶¶¶¶¶¶¶___________
@feynon
feynon / episode.js
Created August 29, 2019 13:30 — forked from mpj/episode.js
Code from the "Dependency Injection Basics" episode of Fun Fun Function
const assert = require('assert')
function getAnimals(fetch, id) {
return fetch('http://api.animalfarmgame.com/animals/' + id)
.then(response => response.json())
.then(data => data.results[0])
}
describe('getAnimals', () => {
it('calls fetch with the correct url', () => {