Skip to content

Instantly share code, notes, and snippets.

View gdevanla's full-sized avatar

Guru Devanla gdevanla

View GitHub Profile
@gdevanla
gdevanla / deploy_dolly_v2.ipynb
Created May 26, 2023 03:39 — forked from timesler/deploy_dolly_v2.ipynb
Deploy Dolly v2.0 to SageMaker
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gdevanla
gdevanla / y-combinator-clojure.clj
Last active October 9, 2022 16:46
Y-Combinator in Clojure based on Jim Weirich's talk Y-NOT
;; This gist roughly transribes the demo
;; by Jim Weirich during his talk on Y-Combinator
;; called Y-Not.
;; http://www.infoq.com/presentations/Y-Combinator
;; Jim does a phenomenal job of explaining in the demo.
;; Therefore, this gist only attempts to provide
;; the code example from the poor quality video
;; The examples are simplified at some places
;; based on how I tried to understand it
@gdevanla
gdevanla / parser_combinators.py
Last active October 27, 2021 15:44
Parser Combinator in Python - Notes
import operator
import typing as tp
"""
a. Structure of Parser
p = (s -> Any object)
Partially consuming parser
p1 = (s -> (a, remaining))
-- Notes on how to wrap InputT over StateT to maintain the environment around a language repl.
type HaskellLineT = InputT (StateT Env IO) ()
runScriptInteractive = runStateT (runInputT defaultSettings loop) (initEnv Nothing)
where
loop :: HaskellLineT
loop = do
minput <- getInputLine "%"
when (isNothing minput) loop
import typing as tp
class Abstract:
def func1(self, *, x: int, y: str):
raise NotImplementedError()
@gdevanla
gdevanla / Printf.hs
Created November 12, 2020 04:36 — forked from gergoerdi/Printf.hs
{-# LANGUAGE GADTs, TypeInType, DataKinds, TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeApplications #-}
import GHC.TypeLits
import GHC.Types
import Data.Singletons
import Data.Singletons.Prelude
data Format = Lit Symbol | Str | Shown Type
#https://bcb.github.io/airflow/execute-context
from airflow.models import TaskInstance
ti=TaskInstance(task=t, execution_date=datetime.datetime.now())
ti.get_template_context()
@gdevanla
gdevanla / install-python.sh
Created June 27, 2018 02:20
Install Python 3.6.5 in Ubuntu 16+
#!/bin/bash
export PYTHON_VERSION=3.6.5
export PYTHON_DOWNLOAD_URL=https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz
sudo apt update
sudo apt install --no-install-recommends -y \
software-properties-common build-essential \
libssl-dev libreadline-dev libbz2-dev libsqlite3-dev zlib1g-dev \
python-minimal
@gdevanla
gdevanla / revset_generator.py
Created May 4, 2018 16:23
Using python function call syntax to generated 'revsets' needed by mercurial
'''
Module that can generate revset expressions required by Hg from python function call structures.
'''
def _wrap(outer_fn, *args):
args = args or ''
if args:
args = ", ".join(args)
return '{}({})'.format(outer_fn, args)
@gdevanla
gdevanla / machine_setup.txt
Created February 16, 2018 15:47
machine setup
Remapping keys
https://askubuntu.com/questions/149971/how-do-you-remap-a-key-to-the-caps-lock-key-in-xubuntu
sudo vi /etc/default/keyboard
then find the line that starts with XKBOPTIONS, and add ctrl:nocaps to make Caps Lock an additional Control key or ctrl:swapcaps to swap Caps Lock and Control.
For example, mine looks like