Skip to content

Instantly share code, notes, and snippets.

View scvsh's full-sized avatar
🐻

Arseni Zemskov scvsh

🐻
  • | Superposition >
  • Toronto, Canada
View GitHub Profile
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()),
@scvsh
scvsh / 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
@scvsh
scvsh / 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("/*")
)
.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) {
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) {
@scvsh
scvsh / 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>
/* 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;
@scvsh
scvsh / 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'''))