This file contains hidden or 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/bash | |
# Usage: ./yt-int.sh <youtube_url> | |
if [ -z "$1" ]; then | |
echo "Usage: $0 <youtube_url>" | |
exit 1 | |
fi | |
URL="$1" |
This file contains hidden or 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 method assumes that the files 'casaos.png' and 'shiny-test.txt' exist in the 'www' subdirectory. | |
# They don't have to be in the 'www' subdirectory. If they're located elsewhere, modify the file paths accordingly. | |
library(shiny) | |
# UI | |
ui <- fluidPage( | |
titlePanel("Image Download Example"), | |
mainPanel( |
This file contains hidden or 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
# 1. Generate sample data | |
set.seed(123) | |
sample_data <- rnorm(100, mean = 0, sd = 1) # A sample from a standard normal distribution | |
# 2. Define the theoretical CDF (for standard normal distribution) | |
# In R, pnorm() is the CDF for the normal distribution | |
theoretical_cdf <- function(x) pnorm(x, mean = 0, sd = 1) | |
# 3. Compute the ECDF of your sample | |
ecdf_sample <- ecdf(sample_data) |
This file contains hidden or 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
$ tree | |
├── app | |
│ └── myapp | |
│ └── app.R | |
└── compose.yml | |
$ mkdir -p app/myapp | |
$ sudo chmod 777 app/myapp # shiny user can write | |
$ docker compose up | |
# Click the 'Write Output File' button |
This file contains hidden or 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
<?xml version='1.0' encoding='UTF-8' standalone='yes'?> | |
<sbgn xmlns="http://sbgn.org/libsbgn/0.3"> | |
<map id="causative.nwt" language="sif"> | |
<extension> | |
<renderInformation | |
xmlns="http://www.sbml.org/sbml/level3/version1/render/version1" id="renderInformation" program-name="sbgnviz" program-version="6.0.1" background-color="#00000000"> | |
<listOfColorDefinitions> | |
<colorDefinition id="color_1" value="#ffffffff"/> | |
<colorDefinition id="color_2" value="#323232"/> | |
<colorDefinition id="color_3" value="#ff8164"/> |
This file contains hidden or 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
1. The Elevator Pitch Summary | |
Prompt: "Summarise this paper in 3–5 sentences, as if you're explaining it to a colleague in an elevator ride." | |
2. Key Findings Extraction | |
Prompt: "List the top 5 key findings or conclusions from this paper, along with a brief explanation of each." | |
3. Methodology Breakdown | |
Prompt: "Explain the methodology used in this study in simple terms. What are its strengths and potential limitations?" | |
4. Literature Review Assistant |
This file contains hidden or 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
calculate_total <- function(items) { | |
subtotal <- sum(items) | |
tax_rate <- getOption("TAX_RATE", default = 0.1) # Default 10% tax | |
total <- subtotal * (1 + tax_rate) | |
return(round(total, 2)) | |
} | |
# Test the function with default tax rate | |
cart1 <- c(10, 20, 30) | |
print(calculate_total(cart1)) # Output: 66.00 |
This file contains hidden or 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 requests | |
from requests.auth import HTTPBasicAuth | |
username = "USERNAME" | |
app_password = "API_PASSWORD" | |
base_url = f"https://api.bitbucket.org/2.0/repositories/{username}" | |
def fetch_repositories(url): | |
response = requests.get(url, auth=HTTPBasicAuth(username, app_password)) | |
response.raise_for_status() # Raises an error for bad status codes |
This file contains hidden or 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
library(shiny) | |
# Define the UI | |
ui <- fluidPage( | |
titlePanel("Rainbow Color Palette"), | |
sidebarLayout( | |
sidebarPanel( | |
sliderInput("s_value", "Saturation (s):", min = 0, max = 1, value = 1, step = 0.01), | |
sliderInput("v_value", "Value (v):", min = 0, max = 1, value = 1, step = 0.01) | |
), |
This file contains hidden or 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
library(survival) | |
# Function to generate survival data | |
generate_data <- function(sample_size, event_rate_group1, event_rate_group2) { | |
group <- c(rep(1, sample_size), rep(0, sample_size)) | |
event_times <- c(rexp(sample_size, rate = event_rate_group1), | |
rexp(sample_size, rate = event_rate_group2)) | |
observed <- rep(1, sample_size * 2) # Assuming all events are observed | |
data <- data.frame(group = group, event_times = event_times, observed = observed) | |
return(data) |
NewerOlder