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
# install DSPy: pip install dspy | |
import dspy | |
# Ollam is now compatible with OpenAI APIs | |
# | |
# To get this to work you must include `model_type='chat'` in the `dspy.OpenAI` call. | |
# If you do not include this you will get an error. | |
# | |
# I have also found that `stop='\n\n'` is required to get the model to stop generating text after the ansewr is complete. | |
# At least with mistral. |
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 * as IOEffects from 'redux-saga/effects' | |
export function * select (...args) { | |
return yield IOEffects.select(...args) | |
} | |
export function * put (...args) { | |
return yield IOEffects.put(...args) | |
} |
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
#!/bin.sh | |
DOCKER_COMPOSE_VERSION=1.3.0 | |
# Download docker-compose to the permanent storage | |
echo 'Downloading docker-compose to the permanent VM storage...' | |
sudo mkdir -p /var/lib/boot2docker/bin | |
sudo curl -sL https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` -o /var/lib/boot2docker/bin/docker-compose | |
sudo chmod +x /var/lib/boot2docker/bin/docker-compose | |
sudo ln -sf /var/lib/boot2docker/bin/docker-compose /usr/local/bin/docker-compose |
This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.
A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:
- It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
- It is free, with no quotas.
- Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
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
var crypto = require('crypto'); | |
// larger numbers mean better security, less | |
var config = { | |
// size of the generated hash | |
hashBytes: 32, | |
// larger salt means hashed passwords are more resistant to rainbow table, but | |
// you get diminishing returns pretty fast | |
saltBytes: 16, | |
// more iterations means an attacker has to take longer to brute force an |
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
FIELDS = ['cmd', 'command', 'start', 'end', 'delta', 'msg', 'stdout', 'stderr'] | |
def human_log(res): | |
if type(res) == type(dict()): | |
for field in FIELDS: | |
if field in res.keys(): | |
encoded_field = res[field].encode('utf-8') | |
print '\n{0}:\n{1}'.format(field, encoded_field) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
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 gist is compatible with Ansible 1.x . | |
# For Ansible 2.x , please check out: | |
# - https://gist.github.com/dmsimard/cd706de198c85a8255f6 | |
# - https://github.com/n0ts/ansible-human_log | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# |
NewerOlder