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 anthropic | |
import sys | |
import asyncio | |
import time | |
import os | |
ANTHROPIC_API_KEY = 'YOUR-KEY' | |
async def summarize_chunk(text, chunk_size=10000): | |
c = anthropic.Client(ANTHROPIC_API_KEY) |
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
require 'httparty' | |
require 'nokogiri' | |
def google_rank_checker(domain, keyword) | |
url = "https://www.google.com/search?q=#{URI.encode_www_form_component(keyword)}&num=100" | |
headers = { | |
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36', | |
'Accept-Language' => 'en' | |
} | |
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
#!/usr/bin/env ruby | |
require 'fileutils' | |
# Define folder names and corresponding file formats | |
folders = { | |
'music' => ['.mp3', '.wav', '.flac', '.m4a', '.aac'], | |
'images' => ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.tiff', '.JPG', '.PNG'], | |
'photos' => ['.cr2', '.raw', '.nef', '.dng', '.orf'], | |
'web_files' => ['.axd', '.css', '.HTM', '.html', '.js', '.json', '.svg'], |
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 openai | |
import sys | |
import re | |
import time | |
OPENAI_API_KEY = 'your-api-key-here' | |
openai.api_key = OPENAI_API_KEY | |
def tokenize(text: str): |
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
first_hour = "08:06" | |
second_hour = "10:56" | |
third_hour = "14:39" | |
forth_hour = "19:45" | |
def working_hours(first_hour, second_hour, third_hour, forth_hour) | |
first_hour_hours = first_hour.split(":")[0].to_i * 60 + first_hour.split(":")[1].to_i | |
second_hour_hours = second_hour.split(":")[0].to_i * 60 + second_hour.split(":")[1].to_i | |
third_hour_hours = third_hour.split(":")[0].to_i * 60 + third_hour.split(":")[1].to_i |
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
class SlideStories{constructor(id){this.slide=document.querySelector(`[data-slide="${id}"]`);this.active=0;this.init();} | |
activeSlide(index){this.active=index;this.items.forEach((item)=>item.classList.remove('active'));this.items[index].classList.add('active');this.thumbItems.forEach((item)=>item.classList.remove('active'));this.thumbItems[index].classList.add('active');this.autoSlide();} | |
prev(){if(this.active>0){this.activeSlide(this.active-1);}else{this.activeSlide(this.items.length-1);}} | |
next(){if(this.active<this.items.length-1){this.activeSlide(this.active+1);}else{this.activeSlide(0);}} | |
addNavigation(){const nextBtn=this.slide.querySelector('.slide-next');const prevBtn=this.slide.querySelector('.slide-prev');nextBtn.addEventListener('click',this.next);prevBtn.addEventListener('click',this.prev);} | |
addThumbItems(){this.items.forEach(()=>(this.thumb.innerHTML+=`<span></span>`));this.thumbItems=Array.from(this.thumb.children);} | |
autoSlide(){clearTimeout(this.timeout);this.timeout=setTimeout(this.next,5000);} |
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 order_code = [5647, 5648] | |
for (let index = 0; index <= order_code.length; index++) { | |
id = order_code[index] + 1 | |
$('.delete').eq(index).attr('name', 'data[Form][selected][' + id + ']') | |
$('.delete').eq(index).attr('data-id', id) | |
$('.delete').eq(index).attr('data-pedido', order_code[index]) | |
} | |
0 < $(".delete:checked").length ? ($("#pedidoViewForm").prop("action", base_url + "venda/pedidos/printOrderDC"), $("#pedidoViewForm").prop("target", "_blank"), $("#pedidoViewForm").submit()) : Backend.modalInfo('<span class="modal-alert-message-content">Nenhum pedido selecionado</span>', |
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
<style type="text/css">img { | |
max-width: 100%; | |
display: block; | |
} | |
.slide { | |
max-width: 380px; | |
margin: 20px auto; | |
display: grid; | |
box-shadow: 0 4px 20px 2px rgba(0, 0, 0, 0.4); | |
} |
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
select s.order_code, s.* from sales s | |
where order_code in ('3374','3375','3502','3496','3457','3534','3258','3393','3429','3381','3398','3059','3333','3408','3184','3268','3392','3360','3351','3372','3361','3473','3465','2673','3509','3449','3470','2816','3362','3414','3355','3388','3487','3380','3474','3377','3456','3364','3441','3467','3341','3280','3244','3390','3199','3336','3263','3483','3189','3468') | |
order by order_code ; | |
select * from sales where order_code = '3244'; | |
select pp.store_entrance,pp.* from purchase_products pp | |
inner join products p2 on p2.id = pp.product_id | |
where p2.custom_id = '2085' and store_entrance = 2; |
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
=begin | |
Using gem aws-sdk for a ror application for uploading images to s3 | |
Uploading images to a fixed bucket with different folders for each object or application. | |
The s3 keeps a limitation on the number of buckets creattion whereas there is no | |
limitation for content inside a bucket. | |
This code will upload image for a user to s3 using aws-sdk gem. The bucket and the image uploaded are made public | |
so that the images uploaded are directly accessible. The input it takes is the image complete path | |
where it is present, folder in which it should be uploaded and user_id for whom it should | |
be uploaded. |
NewerOlder