Skip to content

Instantly share code, notes, and snippets.

@leegonzales
leegonzales / ChatGPT-Writing Style Analyzer.txt
Last active February 3, 2023 03:34
ChatGPT Prompt: Writing Style Analyzer
Prompt Chaining -
Priming Prompt: “For today's task, you are going to be acting like a highly capable and skilled analyst with excellent attention to detail. You will be tasked with analyzing a writing sample and generating a list of instructions on how to mimic the writing style of the sample. This will require excellent analytical skills and the ability to identify and analyze a variety of writing style attributes, as well as strong language skills to communicate your instructions effectively. Overall, you will need to be highly capable and skilled at analyzing and mimicking writing styles in order to complete this task successfully.”
Tasking Prompt:
“Now - your task is to analyze a writing sample provided below inside {writing sample} and generate a list of instructions on how to mimic the writing style of the sample. These instructions will guide future writing so they must effectively convey the desired writing style, and should be written in affirmative language. Be sure to consider a variety of attrib
@korakot
korakot / selenium.py
Last active March 26, 2024 07:40
Use selenium in Colab
# install chromium, its driver, and selenium
!apt update
!apt install libu2f-udev libvulkan1
!wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
!dpkg -i google-chrome-stable_current_amd64.deb
!wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/118.0.5993.70/linux64/chromedriver-linux64.zip
!unzip -j chromedriver-linux64.zip chromedriver-linux64/chromedriver -d /usr/local/bin/
!pip install selenium chromedriver_autoinstaller
# set options to be headless, ..
@stevenharman
stevenharman / 00_Heroku-Release-Phase-Review-Apps-Rails_README.md
Last active March 11, 2024 04:11
Heroku Release Phase script for managing Rails DB migrations, and playing nice with Review Apps and postdeploy scripts

Heroku Release Phase + Review Apps + Rails

This is a simplified, but fairly thorough, set of scripts and configuration to enable Heroku Release Phase for Rails apps. Further, this particular set up plays nicely with Heroku Review Apps in that the release phase script will:

  1. Fail, loudly, if the DB does not yet exist.
  2. Load the DB schema if the current schema version (as determined by bin/rails db:version) is 0.
  3. Run DB migrations otherwise.

For a "normal" app that usually means it will run the DB migrations.

@kerlin
kerlin / get_workers.rb
Last active November 17, 2021 02:03
Calling the Workday API in Ruby with Savon
#!/usr/bin/env ruby
#
# Example Ruby CLI script to retrieve worker data from Workday
# Call on command line with worker id; prints worker name
# add "request" or "response" after worker id and prints the
# outgoing xml or received hash and exits.
#
# Using Savon version 2 for the SOAP client (2.11.2)
#
# Savon defaults to making the message tag the same as the operation name
@eduncan911
eduncan911 / Revert-Gist.md
Last active July 20, 2023 09:41
Revert Gist Commits

Revert / Undo a Gist Commit

It was not exactly obvious. Here's how to revert a Gist commit!

Checkout the gist like a normal git repo:

# replace the Gist ID with your own
git clone git@github.com:cc13e0fcf2c348cc126f918e4a3917eb.git

Treat it like a normal repo. Edit, force push, etc.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

Realtime Notifications with ActionCable

In this episode we're going to be adding realtime notifications into your app using ActionCable. We've talked about notifications a few times in the past and we used AJAX polling for that. 95% of the time, polling is the solution that would be recommended for it.

But if you're looking for a good introduction into ActionCable then this is a decent one because we're only really using it for one way from the server side to the client side.

Getting started

So to get started we're starting with an app that has Bootstrap installed and then we created a Main controller with an index view which is where we will list our Notifications as for this example.

Before we generate our channels let's install a few things

@jrafanie
jrafanie / gist:5424bc23a5c5fcbe5047
Last active August 7, 2016 04:57
bundler: no place like gem home
$ bundler -v
Bundler version 1.9.7

Add git based rake to Gemfile:

$ cat Gemfile
source 'https://rubygems.org'
@merqlove
merqlove / optimization.rake
Created January 9, 2015 13:55
PostgreSQL optimization tasks for ActiveRecord
namespace :optimization do
desc "Provide DB vacuum for production environment"
task :vacuum => :environment do
begin
tables = ActiveRecord::Base.connection.tables
tables.each do |table|
ActiveRecord::Base.connection.execute("VACUUM FULL ANALYZE #{table};")
end
rescue Exception => exc
Rails.logger.error("Database VACUUM error: #{exc.message}")
@denilsonsa
denilsonsa / Python Virtual Environments on Debian and Ubuntu.md
Last active December 1, 2016 06:25
Python Virtual Environments on Debian and Ubuntu

pyvenv-3.3 (Ubuntu 13.10, also Debian)

Symptoms

pyvenv-3.3 venvdir
venvdir/bin/python -c 'import sys; print(sys.path)'
# This should print the venvdir in sys.path.

But in buggy Ubuntu/Debian, it doesn't.