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
# download http://api.rubyonrails.org | |
wget -r -k -p http://api.rubyonrails.org | |
# find in directory by pattern | |
grep --include={*.c,*.h} -r 'directory' -e "pattern" | |
grep --exclude={*.c,*.h} -r 'directory' -e "pattern" | |
# find files bigger then 32M | |
find . -type f +32M |
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
#!/usr/bin/python | |
import numpy | |
def transformOzVector(alpha, vector): | |
m = numpy.matrix([[numpy.math.cos(alpha), -numpy.math.sin(alpha), 0], | |
[numpy.math.sin(alpha), numpy.math.cos(alpha), 0], | |
[0, 0, 1]]) | |
return m*vector | |
result = transformOzVector(numpy.math.pi*1, numpy.matrix([1,0,0]).T) | |
print result |
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
#!/usr/bin/bash | |
file=`uuidgen` | |
cat "file" | while read v | |
do | |
read x; | |
if [ $x ] | |
then | |
echo $x >> $file | |
fi | |
echo $v >> $file |
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
#!/usr/bin/python | |
import scipy | |
import scipy.linalg | |
def f(a): | |
s = 0 | |
for i in range(len(a)): | |
s+= a[i]*x**i | |
return s | |
def check(roots): | |
for x in roots: |
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 | |
xPoly = [1, 2, 1] | |
yPoly = [-1, 1] | |
np.polydiv(xPoly, yPoly) |
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 | |
# P(x) = 3x^2 + 6x + 1 | |
np.polyval([9, 6, 1], 0) # returns 1 |
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
%pylab inline | |
import matplotlib.pyplot as plt | |
import scipy | |
import scipy.stats | |
g = scipy.stats.norm(-3.5,0.05) | |
r = g.rvs(100) | |
r.sort() | |
print g.median() | |
plt.plot(r, np.array([g.pdf(i) for i in r])) | |
plt.show() |
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
%pylab inline | |
import matplotlib.pylab as plt | |
import re | |
class Vs: | |
def __init__(self,fname): | |
self.fname = fname | |
self.readDate() | |
self.count = 0 | |
self.time = [] | |
def readDate(self): |
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
#!/bin/bash | |
echo "Enter your path to the repository without name" | |
read path | |
cd $path | |
echo "Enter the reponame" | |
read reponame | |
mkdir "$reponame"".git" && cd "$reponame"".git" | |
git init --bare | |
cd hooks |
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
#include <iostream> | |
#include <vector> | |
#include <string> | |
int main() { | |
std::string str1 = "AA"; | |
std::vector< std::string > v; | |
v.push_back(str1); | |
std::cout << str1 << "\n"; // AA | |
v.push_back(std::move(str1)); | |
std::cout << str1 << "\n"; // AA |
OlderNewer