Helpful tools:
brew install git postgresql
#!/usr/bin/env python3 | |
# Note: if spacy isn't working you may need to download english model python -m spacy download en | |
import argparse | |
import json | |
from langchain.text_splitter import NLTKTextSplitter, CharacterTextSplitter, RecursiveCharacterTextSplitter, SpacyTextSplitter, TokenTextSplitter | |
def chunkify(text, chunk_size, chunk_overlap, method): | |
if method == 'nltk': | |
text_splitter = NLTKTextSplitter.from_tiktoken_encoder( |
#! /usr/bin/ruby | |
require 'fileutils' | |
path = "/etc/hosts" | |
sites = %w( | |
news.ycombinator.com | |
reddit.com | |
www.reddit.com |
~/vagrant-setup (master): vagrant plugin install vagrant-hostsupdater | |
Installing the 'vagrant-hostsupdater' plugin. This can take a few minutes... | |
Bundler, the underlying system Vagrant uses to install plugins, | |
reported an error. The error is shown below. These errors are usually | |
caused by misconfigured plugin installations or transient network | |
issues. The error from Bundler is: | |
An error occurred while installing json (1.8.1), and Bundler cannot continue. | |
Make sure that `gem install json -v '1.8.1'` succeeds before bundling. |
Helpful tools:
brew install git postgresql
#!/bin/sh | |
# Called by "git push" after it has checked the remote status, | |
# but before anything has been pushed. | |
# | |
# If this script exits with a non-zero status nothing will be pushed. | |
# | |
# Steps to install, from the root directory of your repo... | |
# 1. git config --global init.templatedir '~/.git-templates' | |
# 2. mkdir -p ~/.git-templates/hooks |
#!/usr/bin/env bash | |
for branch in `git checkout --quiet master && git branch -r --merged | grep origin/ | sed 's/origin\///' | sed '1d;$d' | grep --invert-match master`; do echo -e `git push origin --delete $branch` \\t$branch; done |
#!/bin/sh | |
# Called by "git push" after it has checked the remote status, | |
# but before anything has been pushed. | |
# | |
# If this script exits with a non-zero status nothing will be pushed. | |
# | |
# Steps to install, from the root directory of your repo... | |
# 1. git config --global init.templatedir '~/.git-templates' | |
# 2. mkdir -p ~/.git-templates/hooks |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
PS1="\[\033[0m\]\w\[\033[34m\] \$(parse_git_branch)\[\033[01;36m\]:\[\033[00m\] " |
def largest_prime_factor(number) | |
factors = factors_of(number) | |
factors.select do |f| | |
is_prime?(f) | |
end.max | |
end | |
def factors_of(number) |
#!/bin/sh | |
set -e | |
# Example init script, this can be used with nginx, too, | |
# since nginx and unicorn accept the same signals | |
# Feel free to change any of the following variables for your app: | |
TIMEOUT=${TIMEOUT-60} | |
APP_ROOT=/home/x/my_app/current | |
PID=$APP_ROOT/tmp/pids/unicorn.pid | |
CMD="/usr/bin/unicorn -D -c $APP_ROOT/config/unicorn.rb" |