Skip to content

Instantly share code, notes, and snippets.

#include <functional> // 1.1.7.28
#include <algorithm>
#include <iostream>
#include <utility>
#include <string>
#include <vector>
#include <cmath>
typedef struct {
int ground, has_motor, four_wheel, electric;
@thevar1able
thevar1able / md5.cpp
Created January 15, 2016 12:29
simple md5 implementation
#include <iostream>
#include <stdint.h>
#include <bitset>
#include <cmath>
#include <vector>
#include <fstream>
#include <sstream>
#include <string>
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
@thevar1able
thevar1able / gost28147-89.cpp
Created January 15, 2016 12:32
simple gost28147-89 implementation
#include <algorithm>
#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
#include <bitset>
using namespace std;
std::vector<char> readFile(char* filename) {
Выкачиваем pngquant, jpeg-archive и ставим ladon
git clone git://github.com/pornel/pngquant.git
git clone git://github.com/danielgtaylor/jpeg-archive
npm install -g ladon
Ставим зависимости для сборки (возможно есть ещё)
apt-get install nasm mozjpeg
Собираем и ставим в систему(выполнять в папках jpeg-archive и pngquant)
#include <stdio.h>
#include <string.h>
#define OPEN_BRACKETS 5
#define STR_LENGTH 10
void gen(int length, int opened, int closed, char* str) {
if (opened + closed == 2 * length) {
printf("%s\n", str);
return;
#!/usr/bin/env python3
import time
import logging
from pydbus import SystemBus, SessionBus
from gi.repository import GLib
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
package hw06_pipeline_execution //nolint:golint,stylecheck
type (
I = interface{}
In = <-chan I
Out = In
Bi = chan I
)
type Stage func(in In) (out Out)

on Pi:

ffmpeg -f v4l2 -input_format mjpeg -video_size 1280x720 -framerate 60 -i /dev/video0 -c:v h264_omx -framerate 60 -b:v 1k -flags:v +global_header -bsf:v dump_extra -f rawvideo udp://phi:25000

on client:

vlc --demux h264 udp://@:25000

lenta.com basic promotions API

  • Get your store id at https://lenta.com/api/v1/stores/
  • Grab promoted goods info at:
    https://lenta.com/api/v1/stores/<store_id>/home
    https://lenta.com/api/v1/stores/<store_id>/crazypromotions
    https://lenta.com/api/v1/stores/<store_id>/mobilepromo?hideAlcohol=false&limit=15&offset=0&type=weekly
    
"""
1. Create a list of first names
2. Create a list of last names
3. Combine them randomly into a list of 100 full names
4. Insert into sqlite table "Names"
"""
import sqlite3
import random