I could offer you the L2 logistic regression in Python: example & code, I added a parameter to toggle between Stochastic Gradient Descent and Gradient Descent, I am not sure which one you want.
I think I remember that Andrew Ng covered SVMs in his ML course on coursera, which used MATLAB. I just did a quick google search and found some github repos, e.g., this one which implement the code. You just need to look for the correct section or exercise.
Random Forests are a little bit tricker, since you first want to implement the decision trees efficiently. I'd probably not recommend to implement those yourself, determining the best split along continuous numerical variables can be quite costly. The only implementation that comes to my mind would be the one in scikit-learn here