Skip to content

Instantly share code, notes, and snippets.

Avatar

Anton Yablokov StSav012

View GitHub Profile
View vk_inverted.py
# -*- coding: utf-8 -*-
from typing import List, Dict
import urllib.request
import urllib.error
import os.path
FILES: List[str] = [
# 'test',
# 'aes_light',
@StSav012
StSav012 / parser.c
Last active Feb 27, 2018
INI file parser
View parser.c
#include <stdlib.h>
#include <stdio.h>
/*****************************************************************************
* @function readValue extracts a string value from an INI file
* @param f is a file opened for reading outside the function
* @param section is the section name to look into
* @param key is the key which value is required
* @param buffer is a buffer to store the key value into
* @note @param buffer should be long enough to store the value
@StSav012
StSav012 / calendar.tex
Last active Dec 7, 2017
Calendar Generator
View calendar.tex
\documentclass[a4paper,landscape,14pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage[T2A,T1]{fontenc}
\usepackage[russian,english]{babel}
\usepackage{color}
\usepackage{tabularx}
\usepackage[margin=1cm]{geometry}
\usepackage{pgffor,etoolbox}
\usepackage{hyperref}
\hypersetup{pdftex, pdftitle=Calendar, pdfauthor=StSav012}
@StSav012
StSav012 / sliders.html
Last active Oct 31, 2017
An example of a dynamically created table of sliders, and their values, and miscellaneous info
View sliders.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
* {
color: inherit;
background: inherit;
}
@StSav012
StSav012 / get_weather.sh
Last active Oct 30, 2017
rp5 site parser
View get_weather.sh
lang="ru"
place="Нижний Новгород"
code=5797
file=$(curl -s -o - "http://pda.rp5.ru/?lang=${lang}&q=${place}")
links=$(echo ${file} | grep -o -e "p class=\"navy\">.*<form id=\"f\"" | grep -o -e "=[^=]*" | tail -n +2 | head -n -1)
code=$(echo ${links} | grep -Eo -e "\"[[:digit:]]+" | grep -Eo -e "[[:digit:]]+" | head -n 1)
name=$(echo ${links} | grep -Eo -e "${lang}\">[^<]+" | grep -Eo -e ">.+" | grep -Eo -e "[^>]+" | head -n 1)
file=$(wget -q -O - "http://rp5.ru/${code}/${lang}")
View rk4_mpi.c
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <mpi.h>
#define formaster if(id==0)
#define forothers if(id!=0)
#define dim 2
#define USE_DEFAULT 1 // skip user input
#define DO_HARLEM_SHAKE 1 // show the result
View rk4_omp.cpp
#include <cstdlib>
#include <iostream>
#include <vector>
#include <ctime>
#include <omp.h>
using namespace std;
#define dim 2
#define USE_DEFAULT 1 // skip user input