Skip to content

Instantly share code, notes, and snippets.

@andr0idsensei
andr0idsensei / unvectorized_nnet.py
Last active March 15, 2021 06:45
Vectorized neural network implementation for the Coursera ML course by Andrew Ng, based on the Python implementation written by John Wittenauer here http://www.johnwittenauer.net/machine-learning-exercises-in-python-part-5/ The un-vectorized version is also available for comparison.
import numpy as np
import time
from sklearn.preprocessing import OneHotEncoder
from scipy.io import loadmat
from scipy.optimize import minimize
def load_data(filename):
""" Loads the MNIST data from the given Matlab file name. """
try:
@smhanov
smhanov / description.md
Last active October 18, 2024 19:32
Pipeline multiprocessing for python with generators

Pipeline multiprocessing in Python with generators

Similar to mpipe, this short module lets you string together tasks so that they are executed in parallel.

The difference is that it lets you use generators, functions which yield results instead of returning them. Each yielded item gets passed to the next stage.

You can specify that one or more copies of the workers operate on the input queue.

Things that can be in a stage

@danguita
danguita / myweechat.md
Created January 29, 2017 13:47 — forked from pascalpoitras/1.md
My always up-to-date WeeChat configuration (weechat-dev)

WeeChat Screenshot

Enable mouse support

/mouse enable

Encrypted password in sec.conf

@strikaco
strikaco / iotest.py
Created January 16, 2017 04:38
Python - Are Threads or Processes more appropriate for disk I/O-bound operations?
from threading import Thread
from multiprocessing import Process
from os import remove
from time import time
class IOTest:
max_workers = 10
max_lines = 10000000
@zenxedo
zenxedo / TrueNAS Setup.md
Last active February 22, 2025 07:31 — forked from jacobblock/FreeNAS.md
Ultimate FreeNAS 11.3 iocage Setup

TrueNAS

I will be moving from FreeNAS jails to ubuntu with docker, docker compose, and portainer. FreeNAS support and updates are lacking. There are many advantages to making the switch and with ZFS on linux I think FreeNAS may be a thing of the past. Stay tuned for a new guide of my latest setup. Check out my other gists for progress on the switch. https://gist.github.com/mow4cash/626275e095f7f90898944a85d66b3be6

WARNING READ THIS: This page contains incomplete and possibly incorrect info. The page is constantly being edited and worked on. Many of these should work but some may be broken. Read the code carefully to understand what you are doing, stuff may be need to be changed for your own use. This includes but not limited too JAIL AND ROUTER IPs, YOUR FREENAS MAIN VOLUME,THE MOST RECENT RELEASE OF DOWNLOADED FILES Use at your own risk.There may be helpful info in the comments.

Find me in the FreeNAS forums

@pletch
pletch / scrape_pfsense_dhcp_leases.py
Last active March 2, 2025 22:47
Scrape PFSense DHCP Leases Status Page and Export Results to JSON
#!/usr/bin/env python3
# # This python script provides a function to query the pfsense (+v2.4) dhcp leases status page and return a list of tuples including
# ip, hostname, and mac address. To use, ensure LXML is installed via package manager or via pip.
#
# 16-Dec-2016 - Original release
# 3-Sep-2020 - Minor update to match formatting of leases page in latest pfSense version (2.4.5).
# 9-Sep-2020 - Backported improvements to handle table rows with missing data, use global variables for user/pass/server_ip,
# and return list from scrape function as implemented by fryguy04 in fork here:
# https://gist.github.com/fryguy04/7d12b789260c47c571f42e5bc733a813
@sloanlance
sloanlance / BASH: ISO 8601 Timestamp with Milliseconds
Last active May 6, 2024 14:40
How to get an ISO 8601 timestamp with milliseconds in BASH
Gist title: "BASH: ISO 8601 Timestamp with Milliseconds"
Summary: How to get an ISO 8601 timestamp with milliseconds in BASH
@akostadinov
akostadinov / stack_trace.sh
Last active February 20, 2025 05:44
Get stack trace in Bash shell script/program.
# LICENSE: MIT, wtfpl or whatever OSS license you like
function get_stack () {
STACK=""
local i message="${1:-""}"
local stack_size=${#FUNCNAME[@]}
# to avoid noise we start with 1 to skip the get_stack function
for (( i=1; i<$stack_size; i++ )); do
local func="${FUNCNAME[$i]}"
[ x$func = x ] && func=MAIN
local linen="${BASH_LINENO[$(( i - 1 ))]}"
@SandeepTuniki
SandeepTuniki / popup.css
Created August 5, 2016 08:05
Minimal HTML & CSS required for a popup's skeleton
.popup-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.2);
}
.popup-cnt {
@danieleggert
danieleggert / GPG and git on macOS.md
Last active March 6, 2025 20:45
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys