Skip to content

Instantly share code, notes, and snippets.

View candidosales's full-sized avatar

Candido Sales Gomes candidosales

View GitHub Profile
python273 /
Last active June 16, 2024 11:09
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 /
Last active June 5, 2024 04:46
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 /
Last active April 10, 2024 14:52
Git Commit Message Guidelines
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 / 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 /
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 / Reset MySQL Root Password in Mac
Last active June 17, 2024 18:36
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


  1. sudo /usr/local/mysql/support-files/mysql.server start
  2. sudo /usr/local/mysql/support-files/mysql.server stop
chadmayfield /
Created June 2, 2017 17:24
Install Hashcat on macOS
git clone
mkdir -p hashcat/deps
git clone hashcat/deps/OpenCL
cd hashcat/ && make
./hashcat --version
./hashcat -b -D 1,2
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';
selector: '[scrollTracker]'
export class ScrollTrackerDirective implements AfterViewInit, OnDestroy {