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 October 28, 2023 10:21
Flask Streaming Langchain Example
View app.py
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 November 29, 2023 09:51
Programming as Theory Building - Peter Naur
View programming-as-theory-building.md

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 October 20, 2023 17:02
Git Commit Message Guidelines
View git-commit-message-guidelines.md
@Rush
Rush / memoize-decorator.ts
Last active January 27, 2022 10:18
Using memoizee with observables
View memoize-decorator.ts
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 ?
View Capfile
# 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".
View BarcodeUtils.java
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 October 6, 2023 03:52
Reset MySQL Root Password in Mac OS
View Reset MySQL Root Password in Mac OS.md

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
View hashcat_macos.sh
#!/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
View scroll-tracker.directive.ts
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 {