Date: | 2014-06-02 20:30 |
---|---|
slug: | wsme-with-flask |
tags: | python, programming, wsme, rest |
Authors: | copyninja |
summary: | This is short guide on how to use wsme with Flask applications, writing this because I felt documentation is lacking. |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.6.0; | |
interface AggregatorV3Interface { | |
function decimals() | |
external | |
view | |
returns ( | |
uint8 |
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
use serde_json::{self, from_str, Value}; | |
use std::collections::{HashMap, HashSet}; | |
use util::{bytes_to_hexstr, random_bytes}; | |
const RAW_WORDS: &'static str = r#"{ | |
\"00\": [\"aardvark\", \"adroitness\"], \"01\": [\"absurd\", \"adviser\"], | |
\"02\": [\"accrue\", \"aftermath\"], \"03\": [\"acme\", \"aggregate\"], | |
\"04\": [\"adrift\", \"alkali\"], \"05\": [\"adult\", \"almighty\"], | |
\"06\": [\"afflict\", \"amulet\"], \"07\": [\"ahead\", \"amusement\"], |
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
use std::collections::HashSet; | |
use std::str::FromStr; | |
fn main() { | |
let alphabets = String::from_str("ABCDEFGHIJKLMNOPQRSTUVWXYZ").unwrap(); | |
let alpha_set: HashSet<_> = alphabets.split("").filter(|x| x.len() != 0).collect(); | |
let keyword = String::from_str("SECRET").unwrap(); | |
let keyword_set: HashSet<_> = keyword.split("").filter(|x| x.len() != 0).collect(); | |
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 argparse | |
import requests | |
import sys | |
from collections import namedtuple | |
from bs4 import BeautifulSoup | |
CSResult = namedtuple('CSResult', ['pkg', 'version', 'file', 'href', 'lineno']) | |
def fetch_page(query): |
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 collections | |
def process(line, case): | |
words = line.split(' ') | |
n = len(words) | |
output = "Case #" + str(case) + ": " | |
if n == 1: | |
return output + words[0] | |
for i in range(n): |
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
def process(credits, nitem, items, case): | |
for i in range(nitem-1): | |
for j in range(i+1,nitem): | |
if int(items [i]) + int(items [j]) == credits: | |
return "Case #{}: {} {}".format(case, i+1, j+1) | |
def credit_difference(credits, items): | |
for item in items: | |
yield int(item), credits - int(item) |
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
package main | |
import ( | |
"fmt" | |
"unsafe" | |
) | |
func main() { | |
var a = float32(-10.3) | |
var b = uintptr(unsafe.Pointer (&a)) |
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
#!/bin/sh | |
# Copyright: (c) Vasudev Kamath <[email protected]>, 2014 under the | |
# terms and conditions of MIT/Expat. | |
tmp=$(mktemp --tmpdir=$(pwd)) | |
etmp=$(mktemp --tmpdir=$(pwd)) | |
cleanup() { | |
rm -f "$tmp" "$etmp" |
NewerOlder