Skip to content

Instantly share code, notes, and snippets.

View ekg's full-sized avatar

Erik Garrison ekg

View GitHub Profile
@beratcmn
beratcmn / gemini-duckduckgo-search.py
Created March 20, 2024 14:28
Perplexity like real time search with Gemini 1.0 Pro and Duckduckgo API
"""
Requirements:
annotated-types==0.6.0
cachetools==5.3.3
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
curl-cffi==0.6.2
@moyix
moyix / arith1000_t0.1_k0_p0.0_results.txt
Created February 10, 2022 21:52
Data files for GPT-NeoX-20B arithmetic (100 and 1000 questions)
Question Real Guess Correct? RelErr Digits
What is 18857 - 592? 18265 18265 Yes 0.0% 5/5
What is 30752 - 3087? 27665 27365 No 1.1% 4/5
What is 2241 + 19873? 22114 22114 Yes 0.0% 5/5
What is 5412 + 10169? 15581 15581 Yes 0.0% 5/5
What is 11831 - 9178? 2653 3153 No 18.8% 2/4
What is 1701 * 19933? 33906033 33953373 No 0.1% 4/8
What is 11648 + 17851? 29499 30509 No 3.4% 1/5
What is 29253 - 6202? 23051 22151 No 3.9% 3/5
What is 27365 + 24989? 52354 53554 No 2.3% 3/5
@the-spyke
the-spyke / pipewire.md
Last active May 10, 2024 12:16
Enable PipeWire on Ubuntu 22.04

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Based on Debian Wiki, but simplified for Ubuntu 22.04.

Foreward

This document was originally written several years ago. At the time I was working as an execution core verification engineer at Arm. The following points are coloured heavily by working in and around the execution cores of various processors. Apply a pinch of salt; points contain varying degrees of opinion.

It is still my opinion that RISC-V could be much better designed; though I will also say that if I was building a 32 or 64-bit CPU today I'd likely implement the architecture to benefit from the existing tooling.

Mostly based upon the RISC-V ISA spec v2.0. Some updates have been made for v2.2

Original Foreword: Some Opinion

The RISC-V ISA has pursued minimalism to a fault. There is a large emphasis on minimizing instruction count, normalizing encoding, etc. This pursuit of minimalism has resulted in false orthogonalities (such as reusing the same instruction for branches, calls and returns) and a requirement for superfluous instructions which impacts code density both in terms of size and

@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 8, 2024 21:42
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
- Skelley et al 2013:
- paper: http://genome.cshlp.org/content/23/9/1496.long
- ena: http://www.ebi.ac.uk/ena/data/view/SRP018005 (includes RNA-seq)
- 22 diverse Scer strains
- Bergstrom et al 2014
- paper: https://academic.oup.com/mbe/article-lookup/doi/10.1093/molbev/msu037
- SGRP2
- 19 Scer
- 22 Spar
@lvm
lvm / README.md
Created February 13, 2017 16:37
[WIP] hackish emacs mode for FoxDot

Installation

  1. put foxdot-cli.py in the same directory as the FoxDot installaton (in case you're using virtualenv, otherwise comment from lines 5 to 7)
  2. copy foxdot-mode.el to ~/.emacs.d/lisp
  3. add (defvar foxdot-cli-path "/path/to/foxdot-cli/") in your ~/.emacs file
  4. in Emacs M-x load-library and complete with foxdot-mode
  5. Type C-c C-f or M-x foxdot-start to start
  6. Type C-c C-e or M-x foxdot-execute to evaluate a line or a block of code
@mikelove
mikelove / tsne.R
Last active April 6, 2024 01:11
Exploring behavior of t-SNE on linear data
n <- 200
m <- 40
set.seed(1)
x <- runif(n, -1, 1)
library(rafalib)
bigpar(2,2,mar=c(3,3,3,1))
library(RColorBrewer)
cols <- brewer.pal(11, "Spectral")[as.integer(cut(x, 11))]
plot(x, rep(0,n), ylim=c(-1,1), yaxt="n", xlab="", ylab="",
col=cols, pch=20, main="underlying data")
@debasishg
debasishg / gist:8172796
Last active May 10, 2024 13:37
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&amp;rep=rep1&amp;t
@panzi
panzi / portable_endian.h
Last active April 18, 2024 20:59
This provides the endian conversion functions form endian.h on Windows, Linux, *BSD, Mac OS X, and QNX. You still need to use -std=gnu99 instead of -std=c99 for gcc. The functions might actually be macros. Functions: htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh. License: I hereby put …
// "License": Public Domain
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
// an example on how to get the endian conversion functions on different platforms.
#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)