This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** printenv.s ***/ | |
// Description | |
// printenv - print the environment to stdout | |
// Synopsis | |
// printenv | |
// Build | |
// $ as --32 -o printenv.o printenv.s | |
// $ ld -m elf_i386 -o printenv printenv.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** printenv.s ***/ | |
// Description | |
// printenv - print the environment to stdout | |
// Synopsis | |
// printenv | |
// Build | |
// $ as --32 -o printenv.o printenv.s | |
// $ ld -m elf_i386 -o printenv printenv.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** echo.s ***/ | |
// Description | |
// echo - print arguments to stdout | |
// Synopsis | |
// echo [STRING]... | |
// Build | |
// $ as --32 -o echo.o echo.s | |
// $ ld -m elf_i386 -o echo echo.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** echo.s ***/ | |
// Description | |
// echo - print arguments to stdout | |
// Synopsis | |
// echo [STRING]... | |
// Build | |
// $ as --32 -o echo.o echo.s | |
// $ ld -m elf_i386 -o echo echo.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.section .text | |
# ************************************ | |
# * print macro | |
# * Caller is responsible for setting | |
# * %ecx and %edx, and saving %eax and | |
# * %ebx if necessary. | |
# ************************************ | |
.macro print | |
movl $4, %eax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** printenv.c ***/ | |
// Description | |
// printenv - print the environment to stdout | |
// Synopsis | |
// printenv | |
// Build | |
// $ gcc -o printenv printenv.c | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** echo.c ***/ | |
// Description | |
// echo - print arguments to stdout | |
// Synopsis | |
// echo [STRING]... | |
// Build | |
// $ gcc -o echo echo.c | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fails to properly return true when running sudo -s | |
function is_ssh_from_env() { | |
if [ -n "${SSH_TTY}" ] || \ | |
[ -n "${SSH_CONNECTION}" ] || \ | |
[ -n "${SSH_CLIENT}" ]; then | |
echo "true" | |
else | |
echo "false" | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numpy.ma as ma | |
import theano | |
from theano import tensor as T | |
floatX = theano.config.floatX | |
def getmask(D): | |
return ma.getmaskarray(D) if ma.isMA(D) else np.zeros(D.shape, dtype=bool) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def matrix_factorization_quux( | |
D, P, Q, steps=5000, alpha=0.0002, beta=0.02): | |
K = P.shape[1] | |
P = np.copy(P) | |
Q = np.copy(Q) | |
for step in xrange(steps): | |
for i in xrange(len(D)): | |
for j in xrange(len(D[i])): | |
if not getmask(D)[i, j]: | |
eij = D[i, j] - np.dot(P[i, :], Q[:, j]) |