Skip to content

Instantly share code, notes, and snippets.

View 019ec6e2's full-sized avatar
🕸️

the_magician 019ec6e2

🕸️
View GitHub Profile
@019ec6e2
019ec6e2 / rf_thumbnail_parser.py
Last active April 27, 2017 08:40
RF Thumbnail Parser
from bs4 import BeautifulSoup
import requests
import re
page = requests.get('https://www.rentaphoto.com/rentaphototv')
soup = BeautifulSoup(page.text, 'html.parser')
print page.status_code
columns = soup.findAll('a', href = re.compile('vimeo.com/\d'''))
/* styles for '...' */
.block-with-text {
/* hide text if it more than N lines */
overflow: hidden;
/* for set '...' in absolute position */
position: relative;
/* use this value to count block height */
line-height: 1.2em;
/* max-height = line-height (1.2) * lines max number (3) */
max-height: 4.8em;
@019ec6e2
019ec6e2 / web.config
Created May 31, 2017 08:49
Azure webapp config to serve WOFF files correctly
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension="woff" mimeType="application/font-woff" />
<mimeMap fileExtension="woff2" mimeType="application/font-woff" />
</staticContent>
</system.webServer>
</configuration>
handleScroll() {
let anchor = 120;
let value = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
let tensor = (1/(value/anchor))*7 - 1.8 * ((value/anchor) - 1);
let point = value > anchor ? ( tensor > 0 ? tensor : 0 ): 7;
if (this.scrollIcon !== null) {
this.scrollIcon.setAttribute('points', '0 1,0.5 1,0.67 ' + point/87.5 + ',1 0,0 0');
}
if (this.Affix !== null) {
.wsr-top-button-block {
display: none;
margin-bottom: 1em;
}
.wsr-top-button-block > a{
white-space: normal;
font-weight: 300;
}
@media (min-width: @screen-xs) and (max-width: @screen-xs-max) {
@019ec6e2
019ec6e2 / etherscan_contract_download.py
Created March 19, 2023 15:30
Use this to parse smart contract source code downloaded from Etherscan API
import json
def is_single_file_contract(source_code: str) -> bool:
return (
source_code.startswith("pragma") or
source_code.startswith("//") or
source_code.startswith("\r\n") or
source_code.startswith("/*")
)
@019ec6e2
019ec6e2 / Surya.py
Created April 5, 2023 12:19
python wrapper for Surya solidity analyzer
import subprocess
class Surya:
def __init__(self, contract_path):
self.contract_path = contract_path
self.command = 'surya'
def _run_command(self, arguments):
result = subprocess.run([self.command] + arguments, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True).stdout
use std::cmp::Ordering;
pub struct SortablePoint<'a>(pub &'a RetrievedPoint);
pub fn get_value(kind: &Kind) -> Option<String> {
match kind {
Kind::NullValue(_) => None,
Kind::DoubleValue(value) => Some(value.to_string()),
Kind::IntegerValue(value) => Some(value.to_string()),
@019ec6e2
019ec6e2 / README.md
Created November 4, 2024 05:50 — forked from hourianto/README.md
Current prompts for WebSim (as of July 13, 2024)

Current WebSim prompts and main context. System/User/Assistant blocks denote different roles in the messages array for the API requests. Stuff in {} is either a file that's too big to be inserted directly, or an explanation.

From what I can see, WebSim is mostly "carried" by Claude's creativity.

  • Main prompt: main_prompt.txt - also check main_flow.txt to see how a complete request is made.
  • Edit prompt: edit_prompt.txt- used when right-click editing the element. Uses the currently selected model. I didn't manage to get the whole prompt with the examples, but most of it at least.
  • Fake LLM API prompt: api_prompt.txt - currently WebSim always uses Claude 3.5 Sonnet for this (from info on Discord).
  • Image rewriting prompt: image_gen_prompt.txt - also uses Claude (don't know what model). Not sure what image model is being used, probably some version SDXL (like SDXL Turbo and similar)

The temperature used is 1, at least for Claude.