Skip to content

Instantly share code, notes, and snippets.

View atomize's full-sized avatar
🎹
♩♩

Berti atomize

🎹
♩♩
View GitHub Profile
@AdrianKriger
AdrianKriger / cesium_osm3Dbuildings01.html
Last active October 13, 2022 17:13
basic osm 3D buildings with cesiumjs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<meta name="description" content="Use Viewer to start building new applications or easily embed Cesium into existing applications.">
const poll = ({ fn, validate, interval, maxAttempts }) => {
console.log('Start poll...');
let attempts = 0;
const executePoll = async (resolve, reject) => {
console.log('- poll');
const result = await fn();
attempts++;
if (validate(result)) {
@atomize
atomize / _get.sh
Created February 26, 2019 22:03
bash function to download file from web without cURL/wget
# Add this to your .bashrc
# Use it like: you@console_>$ _get https://website.org/file.txt
_get ()
{
IFS=/ read proto z host query <<< "$1"
exec 3< /dev/tcp/$host/80
{
echo GET /$query HTTP/1.1
echo connection: close
echo host: $host
@ericyd
ericyd / fuse_web_worker.js
Created September 14, 2018 17:19
Fuse JS Web Worker implementation
/************************
search.js
************************/
// an example of how to implement fuse.js with a web worker
var searchWorker; // initialized in document ready function
if(typeof(Worker) !== "undefined") {
if(typeof(searchWorker) == "undefined") {
searchWorker = new Worker('/scripts/searchWorker.js');
}
@markblundeberg
markblundeberg / atomic-size-attack.md
Created February 16, 2018 05:14
Advisory: secret size attack on cross-chain hash lock smart contracts

Advisory: secret size attack on cross-chain hash lock smart contracts

Dr. Mark B Lundeberg, 2018 Feb 15 bitcoincash:qqy9myvyt7qffgye5a2mn2vn8ry95qm6asy40ptgx2

This security advisory notes a vulnerability in the common construction of cross-chain smart contracts (contracts between distinct cryptocurrencies) through hash locking. I focus on the primary use case in [atomic

@santisbon
santisbon / Search my gists.md
Last active June 11, 2024 02:58
How to search gists.

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html

@yandzee
yandzee / index.js
Last active September 3, 2020 02:35
Code retry with promises
// Author: Renat Tuktarov (renat@sourcerer.io)
const retry = function(fn, prev) {
return new Promise((current, reject) => {
const resolve = _ => (prev && prev()) || current();
fn(resolve, delay => {
setTimeout(_ => {
retry(fn, resolve);
}, delay);
@tokland
tokland / promise_map.js
Last active March 1, 2022 00:18 — forked from anvk/promises_reduce.js
Execute promises sequentially (one at at a time) and return array with the results
function promiseMap(inputValues, mapper) {
const reducer = (acc$, inputValue) =>
acc$.then(acc => mapper(inputValue).then(result => acc.push(result) && acc));
return inputValues.reduce(reducer, Promise.resolve([]));
}
/* Example */
const axios = require('axios');
@robdodson
robdodson / index.html
Last active October 4, 2023 18:57
Shady DOM example
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h2>Hello from outside the Shadow DOM!</h2>
@learntheropes
learntheropes / bittrex_private_and_public_api.gs
Last active March 3, 2021 08:57
Bittrex private and public API for Google Apps Script (Google Sheet)
// work in progress
// you need a bittrex API key and secret with read account option enabled
// I assume that all the keys are in the "keys" spreadsheet. The key is in cell B5 and the secret in cell C5
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("keys");
var key = sheet.getRange("B5").getValue()
var secret = sheet.getRange("C5").getValue();
var baseUrl = 'https://bittrex.com/api/v1.1/';
var nonce = Math.floor(new Date().getTime()/1000);