Skip to content

Instantly share code, notes, and snippets.

View sayef's full-sized avatar

Md Saiful I. Sayef sayef

View GitHub Profile
@sayef
sayef / large-file-hash.py
Created June 29, 2022 20:01 — forked from aunyks/large-file-hash.py
Hash a large file in Python
import hashlib as hash
# Specify how many bytes of the file you want to open at a time
BLOCKSIZE = 65536
sha = hash.sha256()
with open('kali.iso', 'rb') as kali_file:
file_buffer = kali_file.read(BLOCKSIZE)
while len(file_buffer) > 0:
sha.update(file_buffer)
@sayef
sayef / ctc_score.py
Created May 6, 2021 11:40 — forked from githubharald/ctc_score.py
Compute confidence score for CTC-decoded text using TensorFlow
"""
Compute score for decoded text in a CTC-trained neural network using TensorFlow:
1. decode text with best path decoding (or some other decoder)
2. feed decoded text into loss function
3. loss is negative logarithm of probability
Example data: two time-steps, 2 labels (0, 1) and the blank label (2).
Decoding results in [0] (i.e. string containing one entry for label 0).
The probability is the sum over all paths yielding [0], these are: [0, 0], [0, 2], [2, 0]
with probability
@sayef
sayef / main.py
Created May 1, 2021 21:28 — forked from stewartadam/main.py
Simple Python proxy server based on Flask and Requests with support for GET and POST requests.
"""
A simple proxy server, based on original by gear11:
https://gist.github.com/gear11/8006132
Modified from original to support both GET and POST, status code passthrough, header and form data passthrough.
Usage: http://hostname:port/p/(URL to be proxied, minus protocol)
For example: http://localhost:5000/p/www.google.com
"""
import re
@sayef
sayef / opencv_setup.sh
Created March 19, 2019 12:48 — forked from Mahedi-61/installing_opencv_from_source_in_Ubuntu_1804.sh
Installing OpenCV and Python3 on Ubuntu 18.04
#!/bin/bash
### This gist is a step by step instructions to build and install OpenCV on python3 on ubuntu 16.04 LTS
### note: The easy and quick way to install opencv is to run pip install opencv-contrib-python
### But this easy pypi installation can’t open video files on GNU/Linux distribution or on mac OS X system.
### Because opencv video I/O depends heavily on FFmpeg. And on some system opencv binaries provided packages are not compiled.
### Therefor we have no way rather than build it from source.
### first update and upgrade pre-install apt-get packages.
sudo apt-get update
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
@sayef
sayef / README.md
Created May 20, 2018 20:11 — forked from joyrexus/README.md
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@sayef
sayef / how-to-install-latest-gcc-on-ubuntu-lts.txt
Created February 10, 2018 10:28 — forked from application2000/how-to-install-latest-gcc-on-ubuntu-lts.txt
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@sayef
sayef / zookeeper-solr-cloud.md
Created October 15, 2017 08:28 — forked from kalharbi/zookeeper-solr-cloud.md
Setting up an external Zookeeper Solr Cluster

Setting up an external Zookeeper Solr Cluster

This is a step by step instruction on how to create a cluster that has three Solr nodes running in cloud mode. These instructions should work on both a local cluster (for testing) and a remote cluster where each server runs in its own physical machine. This was tested on Solr version 5.4.1 and Zookeeper version 3.4.6

Installing Solr and Zookeeper

  • Download and extract Solr:
    • curl -O http://archive.apache.org/dist/lucene/solr/5.5.3/solr-5.5.3.tgz
    • mkdir /opt/solr