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 <stdio.h> | |
#include <stdlib.h> | |
#include <fcntl.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <unistd.h> | |
#define SIZE 12 | |
#pragma pack(1) | |
struct Data | |
{ |
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 <stdio.h> | |
#include <string.h> | |
int cmp(int p, int perm) | |
{ | |
if((p & 1) && !(perm & 1)) | |
return 0; | |
if(((p >> 1) & 1) && !((perm >> 1) & 1)) | |
return 0; | |
if((p >> 2) && !(perm >> 2)) |
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 <stdio.h> | |
#include <dirent.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main(int argc, char* argv[]) | |
{ | |
DIR *catalog = opendir(argv[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
#include <stdio.h> | |
#include <sys/types.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#include <sys/stat.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
int bytes = 0, end, i, displacement = 0, old_displacement = 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
#include <signal.h> | |
#include <stdio.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/wait.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
int main(int argc, char** argv) |
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
void readbyte(int f, void *p, unsigned int size) { | |
int i, status; | |
unsigned char* ptr = p; | |
for(i = 0; i < size; i++) { | |
status = -1; | |
while(status != 1) // считываем до тех пор, пока рид действительно не считает 1 байт | |
status = read(f, ptr, 1); // записываем результат считывание, -1 если ошибку выдали | |
ptr++; // увечиваем на один байт указатель места считывания | |
} |
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 <signal.h> | |
#include <stdio.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/wait.h> | |
#include <sys/stat.h> | |
int main(int argc, char** argv) | |
{ |
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 <signal.h> | |
#include <stdio.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <fcntl.h> | |
#include <sys/wait.h> | |
#include <sys/stat.h> | |
#include <stdlib.h> | |
#include <limits.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
# -*- coding: utf-8 -*- | |
def translit(s): | |
symbols = (u"абвгдеёзийклмнопрстуфхъыьэюАБВГДЕЁЗИЙКЛМНОПРСТУФХЪЫЬЭЬЬЮ", | |
u"abvgdeezijklmnoprstufh'y'euABVGDEEZIJKLMNOPRSTUFH'Y'EU") | |
tr = {ord(a):ord(b) for a, b in zip(*symbols)} | |
vac = {u'я': 'ya', u'ж': 'zh', u'ц': 'ts', u'ч': 'ch', u'ш': 'sh', u'щ': 'sch', u'Я': 'Ya', u'Ч': 'Ch', u'Ш': 'Sh', u'Щ': 'Sch', u'Ж': 'Zh', u'Ц': 'Ts'} | |
s = s.translate(tr) | |
s = ''.join([vac.get(c, c) for c in s]) | |
return s |
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 urllib | |
import urllib2 | |
import ast | |
def get_info(req): | |
base_url = "http://query.yahooapis.com/v1/public/yql?q=" | |
value = urllib.pathname2url(req) | |
rest = "&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=" | |
response = urllib2.urlopen(base_url + value + rest) | |
html = response.read() |
OlderNewer