Skip to content

Instantly share code, notes, and snippets.

View zerothabhishek's full-sized avatar

Abhishek Yadav zerothabhishek

View GitHub Profile
@shawwn
shawwn / llama_sizes.txt
Created March 5, 2023 18:07
The size of each file distributed with LLaMA, for reference. See https://github.com/shawwn/llama-dl
./tokenizer_checklist.chk 50
./tokenizer.model 499723
./7B/checklist.chk 100
./7B/consolidated.00.pth 13476939516
./7B/params.json 101
./13B/checklist.chk 154
./13B/consolidated.00.pth 13016334699
./13B/consolidated.01.pth 13016334699
./13B/params.json 101
./30B/checklist.chk 262
@noseratio
noseratio / async-generator.js
Last active March 28, 2021 22:09
Async generators and "for await" in JavaScript
// by @noseratio
// https://twitter.com/noseratio/status/1297517388552757249?s=20
// gist: https://gist.github.com/noseratio/721fea7443b74a929ea93c8f6a18cec4/edit
// RunKit: https://runkit.com/noseratio/async-generators-and-for-await-in-javascript
async function delay(ms) {
await new Promise(r => setTimeout(r, ms));
return ms;
}
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active March 27, 2024 06:09
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

@geetotes
geetotes / status.icu.conf
Last active June 5, 2018 12:31
status.icu nginx configuration
server {
root /var/www/status.icu;
index index.html;
server_name status.icu;
location / {
try_files $uri $uri/ =500;
}
location ~ /200 {

I bundled these up into groups and wrote some thoughts about why I ask them!

If these helped you, I'd love to hear about it!! I'm on twitter @vcarl_ or send me an email carl.vitullo@gmail.com

Onboarding and the workplace

https://blog.vcarl.com/interview-questions-onboarding-workplace/

  • How long will it take to deploy my first change? To become productive? To understand the codebase?
  • What kind of equipment will I be provided? Will the company pay/reimburse me if I want something specific?
@shrayasr
shrayasr / danluu.com.css
Last active April 16, 2018 05:18
danluu.com stylesheet
body {
margin: 0 auto;
width: 900px;
font-family: Trebuchet MS;
font-size: 16px;
line-height: 23px;
margin-top: 20px;
background: #fff8ec;
}
@bvaughn
bvaughn / eager-prefetching-async-data-example.js
Last active November 30, 2022 21:16
Advanced example for eagerly prefetching async data in a React component.
// This is an advanced example! It is not intended for use in application code.
// Libraries like Relay may make use of this technique to save some time on low-end mobile devices.
// Most components should just initiate async requests in componentDidMount.
class ExampleComponent extends React.Component {
_hasUnmounted = false;
state = {
externalData: null,
};
@joepie91
joepie91 / random.md
Last active April 27, 2024 22:59
Secure random values (in Node.js)

Not all random values are created equal - for security-related code, you need a specific kind of random value.

A summary of this article, if you don't want to read the entire thing:

  • Don't use Math.random(). There are extremely few cases where Math.random() is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.
  • Don't use crypto.getRandomBytes directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.
  • If you want to generate random tokens or API keys: Use uuid, specifically the uuid.v4() method. Avoid node-uuid - it's not the same package, and doesn't produce reliably secure random values.
  • If you want to generate random numbers in a range: Use random-number-csprng.

You should seriously consider reading the entire article, though - it's

@codesnik
codesnik / ar_opts.rb
Created September 3, 2015 07:20
using ActiveRecord::PredicateBuilder.register_handler
module AROpts
module Helpers
def GT(val); AROpts::GT.new(val); end
def LT(val); AROpts::LT.new(val); end
def GTE(val); AROpts::GTE.new(val); end
def LTE(val); AROpts::LTE.new(val); end
end
GenericOp = Struct.new(:expression)
# speed up pluck
class ActiveRecord::Relation
class RailsDateTimeDecoder < PG::SimpleDecoder
def decode(string, tuple=nil, field=nil)
if Rails.version >= "4.2.0"
@caster ||= ActiveRecord::Type::DateTime.new
@caster.type_cast_from_database(string)
else