Skip to content

Instantly share code, notes, and snippets.

View dyno's full-sized avatar
🏠
Working from home

Dyno Fu dyno

🏠
Working from home
View GitHub Profile
@rain-1
rain-1 / LLM.md
Last active June 15, 2024 08:14
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@heykarimoff
heykarimoff / recover_bucket.py
Created October 24, 2019 04:52
How to Recover Deleted Files in AWS S3 Bucket
#!/usr/bin/env python
from datetime import datetime, timezone
import boto3
# ######################################
#
# Empty Bucket of all delete markers from all objects.
#
# ######################################
@dyno
dyno / date.libsonnet
Created May 31, 2019 05:33
date library for jsonnet
// ported date utility function from http://howardhinnant.github.io/date_algorithms.html
// @param z Days since epoch
// @return Civic date tuple [y, m, d]
local civil_from_days(z) = (
local z1 = z + 719468;
local era = std.floor((if z1 >= 0 then z1 else z1 - 146096) / 146097);
local doe = (z1 - era * 146097); // [0, 146096]
local yoe = std.floor((doe - std.floor(doe / 1460) + std.floor(doe / 36524) - std.floor(doe / 146096)) / 365); // [0, 399]
local y = yoe + era * 400;
@sts10
sts10 / alacritty.yml
Last active December 20, 2023 13:54
My Alacritty config yml for MacOS (compliant with v 0.4.1-dev)
# Configuration for Alacritty, the GPU enhanced terminal emulator
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty it self.
env:
# TERM env customization.
#
# If this property is not set, alacritty will set it to xterm-256color.
#
@ianoc-stripe
ianoc-stripe / S3FileSystem.scala
Created September 25, 2018 23:00
S3FileSystem code to wrap s3
/*
Copyright 2018 Stripe Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT
@davideicardi
davideicardi / README.md
Last active March 8, 2023 15:05
Write and read Avro records from bytes array

Avro serialization

There are 4 possible serialization format when using avro:

@stantonk
stantonk / scalaforpy
Last active August 28, 2021 10:13
Scala for Python Programmers, examples
/*
Notes:
Despite Scala's appearances, it is, in fact, a Statically Typed language.
It has just eliminated a great deal of the "type vomit" people are used
to seeing in Statically Typed languages (e.g. C, C++, Java). It often
can infer the type on its own. It also combines functional and
object-oriented programming paradigms in a fashion that feels similar
to Python.
*/
@MichaelWS
MichaelWS / dataSourcecsv.py
Created June 28, 2013 18:41
example datasource of zipline
"""
leverage work of briancappello and quantopian team
(especcially twiecki, eddie, and fawce)
"""
import pandas as pd
from zipline.gens.utils import hash_args
from zipline.sources.data_source import DataSource
import datetime
import csv
import numpy as np
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@imankulov
imankulov / file_lock.py
Last active December 5, 2017 06:46
This is how we do file locks (python 2.5+)
from __future__ import with_statement
import os
import time
import fcntl
import contextlib
@contextlib.contextmanager
def file_lock(filename, lock_type, timeout=None):
fd = open(filename, 'w')
fctnl_lock_type = getattr(fcntl, lock_type, None)