Skip to content

Instantly share code, notes, and snippets.

View wshbair's full-sized avatar
🎯
Focusing

Wazen Shbair wshbair

🎯
Focusing
View GitHub Profile
@WietseWind
WietseWind / compile.bash
Last active October 12, 2021 08:35
Hook in AssemblyScript
npx asc src/assembly/hook.ts \
-O3 \
--noAssert \
--runtime minimal \
-b build/hook.wasm \
-t build/hook.wat \
-d build/hook.d.ts
@nhapentor
nhapentor / $Running a Private Ethereum Blockchain using Docker.markdown
Last active May 24, 2024 18:25
Setup and run a cluster of nodes to build a private Ethereum network in Docker environment

Running a Private Ethereum Blockchain using Docker

Put genesis.json, Dockerfile, docker-compose.yml and .env files together in the same folder. Then run the command.

docker-compose up
@ferreiro
ferreiro / poissonDistribution.js
Last active February 8, 2024 13:48
Poisson distribution formula in javascript
var k_total = 10; // number of times the event is repeated
var landa = 8; // Promedian number of error expected in a given time (Landa symbol)
var exponential = 2.718281828;
var total = 0;
var numerator, denominator;
// Sumatorio de k terminos usando la formula de poisson
function poisson(k, landa) {
@7h3rAm
7h3rAm / minips.py
Created April 17, 2014 11:07
A minimal IPS
#!/usr/bin/env python
import sys
import re
import datetime, time
import argparse
import nids
end_states = (nids.NIDS_CLOSE, nids.NIDS_TIMEOUT, nids.NIDS_RESET)
@GuillermoPena
GuillermoPena / nodeJs.crypto.calculatingHash.js
Created February 26, 2014 16:30
NodeJS - CRYPTO : How to calculate a hash from file or string
var crypto = require('crypto')
, fs = require('fs')
// Algorithm depends on availability of OpenSSL on platform
// Another algorithms: 'sha1', 'md5', 'sha256', 'sha512' ...
var algorithm = 'sha1'
, shasum = crypto.createHash(algorithm)
// Updating shasum with file content
var filename = __dirname + "/anything.txt"
@amoslanka
amoslanka / graphite_install.sh
Last active February 2, 2024 00:17
Install StatsD on an Ubuntu box, including creating an upstart service and the option to build a graphite box or configure Librato as a backend.
#
# Assumes an independent box (we'll call this one "graphite")
#
# Stay up to date
sudo apt-get update
sudo apt-get upgrade
# Install git
sudo apt-get install g++ curl libssl-dev -y
@evandrix
evandrix / README.md
Created September 11, 2012 00:06
Headless web browsers

Here are a list of headless browsers that I know about:

  • [HtmlUnit][1] - Java. Custom browser engine. JavaScript support/DOM emulated. Open source.
  • [Ghost][2] - Python only. WebKit-based. Full JavaScript support. Open source.
  • [Twill][3] - Python/command line. Custom browser engine. No JavaScript. Open source.
  • [PhantomJS][4] - Command line/all platforms. WebKit-based. Full JavaScript support. Open source.
  • [Awesomium][5] - C++/.Net/all platforms. Chromium-based. Full JavaScript support. Commercial/free.
  • [SimpleBrowser][6] - .Net 4/C#. Custom browser engine. No JavaScript support. Open source.
  • [ZombieJS][7] - Node.js. Custom browser engine. JavaScript support/emulated DOM. Open source.
  • [EnvJS][8] - JavaScript via Java/Rhino. Custom browser engine. JavaScript support/emulated DOM. Open source.
@cjus
cjus / jsonval.sh
Created June 26, 2011 17:42
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`