Skip to content

Instantly share code, notes, and snippets.

View volodymyrsmirnov's full-sized avatar
🚀
Making things happen

Volodymyr Smirnov volodymyrsmirnov

🚀
Making things happen
View GitHub Profile
@volodymyrsmirnov
volodymyrsmirnov / pysurcamui.py
Created July 11, 2012 10:38
Python surveillance ip camera viewer and alert (tested on Foscam cameras)
#!/usr/bin/env python
import gtk, threading, datetime, urllib2, json
import Image, ImageChops, ImageStat, StringIO
CONFIG_FILE = "config.json"
# config sample
#{
# "sensivity": 10,
# -*- coding: utf-8 -*-
"""
Router
~~~~~~~~~~~~~~
Routing API requests and errors handling
"""
from flask import Flask, jsonify, request
from api_versions import *
@volodymyrsmirnov
volodymyrsmirnov / getpidmemory.c
Created October 25, 2012 18:20
Get PID resident memory size for MacOS, FreeBSD and Linux
#ifdef __APPLE__
#include <libproc.h>
#endif
#include <sys/resource.h>
#include <sys/param.h>
#include <sys/user.h>
#include <sys/sysctl.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <sched.h>
#include <errno.h>
#define CHILD_STACK_SIZE 1024 * 1024 * 5 // 5 MB
#define CHILD_TIME_LIMIT 5
#!/bin/bash
CG_ROOT="/sys/fs/cgroup";
function cg_init {
mkdir -p $CG_ROOT;
mount -t tmpfs cgroot $CG_ROOT;
}
function cg_set {
We found a way that includes 23 stations and requires 2 transfers
Route plan: Akademmistechko -> Zhytomyrska -> Sviatoshyn -> Nyvky -> Shuliavska -> Politekhnichnyi Instytut -> Vokzalna -> Universytet -> Teatralna -> Khreshchatyk -> Maidan Nezalezhnosti -> Ploshcha Lva Tolstoho -> Palats Sportu -> Klovska -> Pecherska -> Druzhby Narodiv -> Vydubychi -> Slavutych -> Osokorky -> Pozniaky -> Kharkivska -> Vyrlytsia -> Boryspilska
Consider make a transfer from Khreshchatyk to Maidan Nezalezhnosti
Consider make a transfer from Ploshcha Lva Tolstoho to Palats Sportu
We found a way that includes 21 stations and requires 1 transfers
Route plan: Akademmistechko -> Zhytomyrska -> Sviatoshyn -> Nyvky -> Shuliavska -> Politekhnichnyi Instytut -> Vokzalna -> Universytet -> Teatralna -> Zoloti Vorota -> Palats Sportu -> Klovska -> Pecherska -> Druzhby Narodiv -> Vydubychi -> Slavutych -> Osokorky -> Pozniaky -> Kharkivska -> Vyrlytsia -> Boryspilska
Consider make a transfer from Teatralna to Zoloti Vorota
{% macro pagination(total, per_page, curr_page, sorting, order, search_id) %}
{% set pages_quantity = (total / per_page) | round(1, 'floor') | int %}
{% if pages_quantity != 0 %}
<div class="pages">
<div class="content pagination">
<div class="pagination">
<ul>
<li {% if curr_page -1 <= 0 %}class="disabled"{% endif %}><a href="?page={{ curr_page - 1 }}&amp;sorting={{ sorting }}&amp;order={{ order }}{% if search_id %}&amp;search_id={{ search_id }}{% endif %}">&laquo;</a></li>
@volodymyrsmirnov
volodymyrsmirnov / general.cfg
Last active June 10, 2022 12:11
Simple Python daemon for forwarding SMS to email, tested on Samsung and Nokia phones
[general]
debug: true
[tty]
dev: /dev/tty.usbmodemfa132
baudrate: 9600
timeout: 0.01
[email]
enabled: true
#import <Foundation/Foundation.h>
#include "openssl/bn.h"
#include "openssl/evp.h"
#include "openssl/err.h"
#include "openssl/pem.h"
#include "openssl/ssl.h"
// SSH key types
typedef enum SSHKeyType : short {
~ smirnov$ echo "int main(){}; int sum(x, y){int result; result=x+y; return result;}" | clang -O3 -o test.o -xc - && otool -vt test.o -p _sum
test.o:
(__TEXT,__text) section
_sum:
0000000100000f90 pushq %rbp
0000000100000f91 movq %rsp, %rbp
0000000100000f94 addl %esi, %edi
0000000100000f96 movl %edi, %eax
0000000100000f98 popq %rbp
0000000100000f99 ret