Skip to content

Instantly share code, notes, and snippets.

View abeosoft's full-sized avatar

Abdul Ouhammou abeosoft

  • Virginia, Kentucky
View GitHub Profile
var brain = require('brain.js')
var fs = require('fs')
// configuration to be used in the brain
const config = {
binaryThresh: 0.5, // arbitary value
hiddenLayers: [3], // the size of the hidden layers in the network
activation: 'sigmoid' // activation function
}
@alastairparagas
alastairparagas / multithreading_request.py
Last active August 28, 2018 17:04
Multithreading requests in Python
from concurrent.futures import ThreadPoolExecutor
from http.client import HTTPException
from urllib import request
from typing import Union, Dict, Any, List
def get_request_task(url: str) -> Union[List[Dict[str, Any]], None]:
try:
contents = None
with request.urlopen(url) as response:
@leifoolsen
leifoolsen / AcceptGZIP.java
Last active July 19, 2023 20:19
JAX-RS 2: How to compress response if client accepts gzip; "Accept-Encoding: gzip, deflate, sdch"
// Create a WriterInterceptor,
// see: https://jersey.java.net/documentation/latest/user-guide.html#d0e9728
import ...
@Provider
public class GZIPWriterInterceptor implements WriterInterceptor {
private final Logger logger = LoggerFactory.getLogger(getClass());
private HttpHeaders httpHeaders;
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@dkincaid
dkincaid / WordCount.java
Last active September 6, 2018 03:50
Hadoop job remote submission
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;