This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on younesbelkada/finetune_llama_v2.py | |
# Install the following libraries: | |
# pip install accelerate==0.21.0 peft==0.4.0 bitsandbytes==0.40.2 transformers==4.31.0 trl==0.4.7 scipy | |
from dataclasses import dataclass, field | |
from typing import Optional | |
import torch | |
from datasets import load_dataset | |
from transformers import ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
config: { | |
// default font size in pixels for all tabs | |
fontSize: 13, | |
// font family with optional fallbacks | |
fontFamily: '"Droid Sans Mono", Menlo, monospace', | |
// terminal cursor background color (hex) | |
cursorColor: '#cccccc', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { EventEmitter } from "events"; | |
import { Map } from "immutable"; | |
const CHANGE_EVENT = "change"; | |
class Store extends EventEmitter { | |
constructor() { | |
super(); | |
this.data = new Map(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set variables in .bashrc file | |
# don't forget to change your path correctly! | |
export GOPATH=$HOME/golang | |
export GOROOT=/usr/local/opt/go/libexec | |
export PATH=$PATH:$GOPATH/bin | |
export PATH=$PATH:$GOROOT/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Runner { | |
public function __construct() { | |
pcntl_signal(SIGCHLD, SIG_IGN); | |
} | |
public function go() { | |
if (pcntl_fork()) return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace General\GeneralBundle\EventListener; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
use Knp\Component\Pager\Event\ItemsEvent; | |
use Doctrine\ORM\Query; | |
use Doctrine\ORM\QueryBuilder; | |
class KnpPaginatorQuerySubscriber implements EventSubscriberInterface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This script will boot app.js with the number of workers | |
// specified in WORKER_COUNT. | |
// | |
// The master will respond to SIGHUP, which will trigger | |
// restarting all the workers and reloading the app. | |
var cluster = require('cluster'); | |
var workerCount = process.env.WORKER_COUNT || 2; | |
// Defines what each worker needs to run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Minimal FRP Behaviors and Events. | |
// An event function is any function of shape `function (next) { ... }` where | |
// `next(value)` is a callback to be called by event function. Transformations | |
// of event are accomplished by wrapping event with another event function, | |
// and consuming original event within (CPS). | |
// A behavior is any function of shape `function (time) { ... }`, where | |
// `time` is current time. Behaviors may capture state, return value from time, | |
// or be constant. Behaviors must always return a value, but value may |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thread' | |
class Waiter | |
def initialize | |
@mutex = Mutex.new | |
end | |
def can_eat? philosopher | |
left = philosopher.left_fork | |
right = philosopher.right_fork |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% @doc Reverse Polish Notation Calculator. | |
%% | |
%% Parses expressions like "1 2 3 + -" = -4 | |
%% | |
%% This is an exercise in Learn You some Erlang for Great Good, | |
%% however I didn't read the text and just implemented it. | |
%% | |
%% I guess understanding stack-based parsing helps here. | |
-module(calc). | |
-export([rpn/1]). |
NewerOlder