Skip to content

Instantly share code, notes, and snippets.

Avatar
🏎️
Focusing

Aleksei Petrenko alex-petrenko

🏎️
Focusing
View GitHub Profile
View factorial.py
# expensive way to compute factorial of n
def factorial(n):
def f(x):
return tf.pow(x, n)
for i in range(n):
f = tfe.gradients_function(f)
return f(1.)
@thirdwing
thirdwing / memory_check.cpp
Created Aug 16, 2014
C++ code to print out runtime memory usage
View memory_check.cpp
#include <iostream>
#include <fstream>
#include <unistd.h>
void process_mem_usage(double& vm_usage, double& resident_set)
{
vm_usage = 0.0;
resident_set = 0.0;
// the two fields we want
@kelvinn
kelvinn / gist:512f72bf1015047af945
Created Jun 6, 2014
Recursively Change Line Endings (Windows)
View gist:512f72bf1015047af945
REM On Unix you would do this: find ./ -type f -exec dos2unix {} \;
REM After installing dos2unix.exe in Windows, you can create a small bat script with the below in it to
REM recursively change the line endings. Careful if you have any hidden directories (e.g. .git)
for /f "tokens=* delims=" %%a in ('dir "C:\Users\username\path\to\directory" /s /b') do (
"C:\Program Files\unix2dos.exe" %%a
)