Skip to content

Instantly share code, notes, and snippets.

View candidosales's full-sized avatar
🏠
Focusing

Candido Sales Gomes candidosales

🏠
Focusing
View GitHub Profile
@python273
python273 / app.py
Last active April 19, 2024 11:05
Flask Streaming Langchain Example
import os
os.environ["OPENAI_API_KEY"] = ""
from flask import Flask, Response, request
import threading
import queue
from langchain.chat_models import ChatOpenAI
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
from langchain.schema import AIMessage, HumanMessage, SystemMessage
@onlurking
onlurking / programming-as-theory-building.md
Last active April 19, 2024 22:31
Programming as Theory Building - Peter Naur

Programming as Theory Building

Peter Naur

Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct

@janderssonse
janderssonse / git-commit-message-guidelines.md
Last active April 10, 2024 14:52
Git Commit Message Guidelines
@Rush
Rush / memoize-decorator.ts
Last active January 27, 2022 10:18
Using memoizee with observables
import { decorate } from 'core-decorators';
import * as memoize from 'memoizee';
import { duration, unitOfTime } from 'moment';
import { memoizeObservable } from './rxjs';
type HumanDuration = [number, unitOfTime.DurationConstructor];
export interface MemoizeOptions extends memoize.Options {
observable?: boolean;
ttl?: HumanDuration;
@Austex
Austex / Capfile
Last active May 28, 2019 15:53
Capistrano deploy webpacker:install error - Webpack binstubs not found. Have you run rails webpacker:install ?
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
@adrianoluis
adrianoluis / BarcodeUtils.java
Created September 4, 2017 02:04
This class validate a barcode and convert it to "Linha Digitável".
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
/**
* This class validate a barcode and convert it to "Linha Digitável".
*
* @author adriano
* @since Set 25, 2014
@zubaer-ahammed
zubaer-ahammed / Reset MySQL Root Password in Mac OS.md
Last active April 4, 2024 10:38
Reset MySQL Root Password in Mac OS

Reset mysql root password in Mac OS:

First Stop MySQL:

  1. Go to: 'System Preferences' >> 'MySQL' and stop MySQL

OR,

  1. sudo /usr/local/mysql/support-files/mysql.server start
  2. sudo /usr/local/mysql/support-files/mysql.server stop
@chadmayfield
chadmayfield / hashcat_macos.sh
Created June 2, 2017 17:24
Install Hashcat on macOS
#!/bin/bash
git clone https://github.com/hashcat/hashcat.git
mkdir -p hashcat/deps
git clone https://github.com/KhronosGroup/OpenCL-Headers.git hashcat/deps/OpenCL
cd hashcat/ && make
./hashcat --version
./hashcat -b -D 1,2
./example0.sh
@rosslavery
rosslavery / scroll-tracker.directive.ts
Created May 25, 2017 16:03
Angular service to save / restore scroll position of arbitrary elements on route change
import { AfterViewInit, Directive, ElementRef, NgZone, OnDestroy } from '@angular/core';
import { NavigationEnd, NavigationStart, Router } from '@angular/router';
import { Subscription } from 'rxjs/Subscription';
import { ScrollTrackerService } from './scroll-tracker.service';
@Directive({
selector: '[scrollTracker]'
})
export class ScrollTrackerDirective implements AfterViewInit, OnDestroy {