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
//string.erase(std::remove_if(string.begin(),string.end(),&condition),string.end()) | |
#include <algorithm> | |
#include <string> | |
bool condition(char c) | |
{ | |
return c==' '; //simple example | |
} |
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
#example, will evalute and return the command inside the backticks `` to arguement | |
echo `pkg-config --cflags --libs gtk+-2.0` | |
#general | |
command `inner_command` |
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
from hashlib import sha1 | |
import numpy | |
arr=numpy.zeros((256,256,4)) | |
sha1(arr) |
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
A=sym('[a b 0;c d 0;0 0 1]') | |
A*[1 0 0]' |
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
sudo apt-get purge nvidia* | |
#remove xorg.conf | |
sudo apt-get --reinstall xserver-xorg-core libgl1-mesa-glx:i386 libgl1-mesa-glx:amd64 libgl1-mesa-dri:i386 libgl1-mesa-dri:amd64 | |
sudo dpkg-reconfigure xserver-xorg | |
sudo reboot | |
sudo apt-get install nvidia-current | |
#if this doesn't work | |
sudo apt-get install linux-headers-generic-pae |
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
nvidia-smi -a | grep Used |
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
:%!xxd #set | |
:%!xxd -r #unset | |
Stream vim’s buffer through the external program ‘xxd’ |
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 int2bits(i,n,zero_element=0,one_element=1): | |
return list((zero_element,one_element)[i>>j & 1] for j in xrange(n-1,-1,-1)) | |
for i in range(16): | |
print int2bits(i,4) |
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 maplist(a,indices): | |
return map(lambda i:operator.getitem(a,i),indices) |
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
dozsmatrix=dict(map(lambda a:(a,filter(lambda b:a*b==Zero,R)),R)) | |
groupofunit=dict(map(lambda a:(a,filter(lambda b:a*b==e,Rstar)),Rstar)) |
OlderNewer