Skip to content

Instantly share code, notes, and snippets.

Let's start with octal. That's base8.
You'd count it 0,1,2,3,4,5,6,7,10,11,12...
There's only the digits 0 thru 7 , and when you get to 8, that's 10.
So, if you have 12 in octal, that's (1*8) + 2, which is 10 in decimal.
And, 100 in octal would be 1*(8 squared), or 64 decimal.
@loretoparisi
loretoparisi / fasttext_confusion_matrix.py
Last active November 4, 2022 13:21
Calculate FastText Classifier Confusion Matrix
#!/usr/local/bin/python3
# @author cpuhrsch https://github.com/cpuhrsch
# @author Loreto Parisi loreto@musixmatch.com
import argparse
import numpy as np
from sklearn.metrics import confusion_matrix
def parse_labels(path):
with open(path, 'r') as f:
@umidjons
umidjons / youtube-dl-download-audio-only-on-best-quality.md
Last active March 9, 2024 07:54
Download Audio from YouTube with youtube-dl

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@DanielBeckstein
DanielBeckstein / Installing-xgboost.md
Last active November 10, 2023 12:07
How to install xgboost for Python on Linux

Commands Linux-Terminal

How to use inside python scripts

@danijar
danijar / blog_tensorflow_sequence_labelling.py
Last active January 12, 2024 15:18
TensorFlow Sequence Labelling
# Example for my blog post at:
# http://danijar.com/introduction-to-recurrent-networks-in-tensorflow/
import functools
import sets
import tensorflow as tf
def lazy_property(function):
attribute = '_' + function.__name__
@vinhkhuc
vinhkhuc / simple_mlp_tensorflow.py
Last active December 22, 2021 11:52
Simple Feedforward Neural Network using TensorFlow
# Implementation of a simple MLP network with one hidden layer. Tested on the iris data set.
# Requires: numpy, sklearn>=0.18.1, tensorflow>=1.0
# NOTE: In order to make the code simple, we rewrite x * W_1 + b_1 = x' * W_1'
# where x' = [x | 1] and W_1' is the matrix W_1 appended with a new row with elements b_1's.
# Similarly, for h * W_2 + b_2
import tensorflow as tf
import numpy as np
from sklearn import datasets
from sklearn.model_selection import train_test_split
#!/usr/bin/env jjs
/*####################################################################################################################################
# As Nashorn does not have http capabilities through XMLHttpRequest (DOM API), we have to use regular Java classes instead.
# This sample shows how this can be acheived without depending on any third party libraries. Just a standard Java 8 JDK.
# Make sure to have JAVA_HOME/bin on your PATH for the shebang to work. Then just chmod +x away and run...
# Alternatively if you're on a non *nix OS, start with jjs -scritping httpsample.js
####################################################################################################################################*/
var url = "https://api.github.com/users/billybong/repos";
var response;
@mloskot
mloskot / boost_property_tree_json_array.cpp
Created December 22, 2011 11:11
Simple example of parsing and consuming JSON array with boost::property_tree
#ifdef _MSC_VER
#include <boost/config/compiler/visualc.hpp>
#endif
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/foreach.hpp>
#include <cassert>
#include <exception>
#include <iostream>
#include <sstream>
@ericrswanny
ericrswanny / LinkedList.java
Created September 10, 2011 14:01
A linked list class implemented in Java
/*============================================================================
Name : LinkedList.java
Author : Eric Swanson
Date : Sep 7, 2011
Version :
Description :
Copyright (C) 2011 Eric Swanson
This program is free software: you can redistribute it and/or modify