Skip to content

Instantly share code, notes, and snippets.

View david-roark's full-sized avatar

David Roark david-roark

  • Ho Chi Minh city
  • 09:50 (UTC +07:00)
View GitHub Profile
#!/bin/bash
set -e
# Fetch latest version information from API
API_RESPONSE=$(curl -s "https://www.cursor.com/api/download?platform=linux-x64&releaseTrack=stable")
DOWNLOAD_URL=$(echo "$API_RESPONSE" | grep -oP '(?<="downloadUrl":")[^"]*')
VERSION=$(echo "$API_RESPONSE" | grep -oP '(?<="version":")[^"]*')
if [ -z "$DOWNLOAD_URL" ] || [ -z "$VERSION" ]; then
echo "Failed to retrieve download URL or version. Exiting."
@david-roark
david-roark / cuda_install.md
Created December 20, 2023 03:30 — forked from denguir/cuda_install.md
Installation procedure for CUDA & cuDNN

How to install CUDA & cuDNN on Ubuntu 22.04

Install NVIDIA drivers

Update & upgrade

sudo apt update && sudo apt upgrade

Remove previous NVIDIA installation

@david-roark
david-roark / actions.py
Created August 29, 2023 13:57 — forked from Horizon733/actions.py
How to add Carousels on Rasa-webchat by Botfront
class ActionCarousel(Action):
def name(self) -> Text:
return "action_carousels"
def run(self, dispatcher, tracker: Tracker, domain: "DomainDict") -> List[Dict[Text, Any]]:
message = {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [

Get all records in state

Rails.application.eager_load!
ActiveRecord::Base.subclasses(&:name)

Get last console output

variable = _

Run a rails console in Sandbox mode

@david-roark
david-roark / regexp_syntax.md
Created May 10, 2023 15:27 — forked from glv/regexp_syntax.md
Ruby and PostgreSQL Regular Expressions

Ruby and Postgres Regular Expression Syntaxes

Ruby's regular expressions are unusually powerful. Postgres' regular expressions are not as powerful, but they come close; close enough that it's possible to do many pattern-based queries and string transformations entirely in a query.

And sometimes, it's very useful to have a single regular expression that works

@david-roark
david-roark / introduction.md
Created May 9, 2023 16:12 — forked from wagnerjgoncalves/introduction.md
Notes from Growing Rails Applications in Practice

Growing Rails Applications in Practice

  • How to use discipline, consistency and code organization to make your code grow more gently.

  • As you cycle through patterns, your application is becoming a patchwork of different coding techniques.

    All those new techniques actually help, or if you are just adding layers of inderection.

  • Large applications are large so what we can do is organize a codebase in a way that "scales logarithmically".

Arel Cheatsheet on Steroids

A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.

Tables

posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord

Table alias