Skip to content

Instantly share code, notes, and snippets.

View EliasGit2017's full-sized avatar
I may be slow to respond.

ElBe2049 EliasGit2017

I may be slow to respond.
View GitHub Profile
@younesbelkada
younesbelkada / finetune_llama_v2.py
Last active May 14, 2024 05:46
Fine tune Llama v2 models on Guanaco Dataset
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
from langchain.callbacks.base import BaseCallbackHandler
import azure.cognitiveservices.speech as speechsdk
import os
import base64
import time
class StreamDisplayHandler(BaseCallbackHandler):
def __init__(self, container, initial_text="", display_method='markdown'):
self.container = container
self.text = initial_text
self.display_method = display_method
@tgroshon
tgroshon / install_elixir_ubuntu21-10.bash
Last active April 27, 2023 10:36
Installing Latest Erlang and Elixir on Ubuntu 20+
# Install the Erlang Solutions apt key; Alternative way https://askubuntu.com/questions/1286545/what-commands-exactly-should-replace-the-deprecated-apt-key
wget https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc
sudo apt-key add erlang_solutions.asc
# 'focal' is the latest available but an empty 'impish' directory exists and will probably be ready soon
sudo echo 'deb https://packages.erlang-solutions.com/ubuntu focal contrib' | sudo tee /etc/apt/sources.list.d/erlang-solutions.list
sudo apt update
sudo apt install esl-erlang elixir
@jpmonettas
jpmonettas / lazy-primes.clj
Created July 25, 2018 22:51
Clojure lazy primes
;; Addapted from python generator found at https://zach.se/project-euler-solutions/10/#python
(defn lazy-primes
"A lazy sequence that yields prime numbers using Eratosthenes Sieve impl."
([] (lazy-primes 2 {}))
;; n is the number we are checking for primality
;; facts maps composite integers to primes
([n facts]
(if (not (contains? facts n))
(lazy-seq (cons n ;; yield since its not composite
@darbula
darbula / test.py
Last active April 12, 2022 07:21
Competitive programming simple input output testing.
import argparse
import os
import re
import sys
from sys import platform
from subprocess import check_output, STDOUT, CalledProcessError
from itertools import izip_longest
from timeit import timeit
from subprocess import Popen
from threading import Timer

emacs --daemon to run in the background. emacsclient.emacs24 <filename/dirname> to open in terminal

NOTE: "M-m and SPC can be used interchangeably".

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u
  1. Lower Case : M-l
@rxaviers
rxaviers / gist:7360908
Last active June 12, 2024 18:38
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@lovasoa
lovasoa / longest-increasing-subsequence.py
Last active October 1, 2020 19:58
Solution to the longest increasing subsequence problem, in 5 lines of python
def lis(a):
L = []
for (k,v) in enumerate(a):
L.append(max([L[i] for (i,n) in enumerate(a[:k]) if n<v] or [[]], key=len) + [v])
return max(L, key=len)
inp = [int(a) for a in input("List of integers: ").split(' ')]
print(lis(inp));