Skip to content

Instantly share code, notes, and snippets.

View maxp's full-sized avatar

Maxim Penzin maxp

View GitHub Profile
@maxp
maxp / calc-sha1.js
Created February 8, 2014 14:12
calc sha1
require('crypto').createHash('sha1').update("123").digest('hex')
@maxp
maxp / rasp-setup
Created April 29, 2014 16:07
Raspberry Pi Setup - embedded
### Raspberry Pi setup
(29.04.2014)
http://downloads.raspberrypi.org/raspbian_latest
# 2014-01-07-wheezy-raspbian.zip
dd if=2014-01-07-wheezy-raspbian.img od=/dev/mmcblk0
@maxp
maxp / session-example.py
Created April 30, 2014 03:31
python-session-example
# -*- coding: utf-8 -*-
"""
mpws: main
@author: maxp
"""
from datetime import datetime, timedelta
import conf
@maxp
maxp / poweroff.c
Created July 7, 2014 12:01
arduino pro micro - 5 min power off
//
// arduino pro micro
//
#define POWER_GREEN 240
#define POWER_YELLOW 40
#define POWER_BLINK 20
#define POWER_OFF 3
@maxp
maxp / gist:504ea9982c77a1747805
Created August 4, 2014 09:16
openirk-admirk sample
<div id="openirk_socmap"></div>
<script type="text/javascript">
window.OPENIRK_USER_ID = "unique_id";
window.OPENIRK_USER_FAMILY = "Иванов";
window.OPENIRK_USER_NAME = "Иван";
window.OPENIRK_USER_PATR = "Петрович";
window.OPENIRK_USER_EMAIL = "ivan@ivanov.ru";
/*
// - http://habrahabr.ru/post/236251/
// set edge event on specific gpio_line
int gpio_edge_set(int n, const char *edge_str)
{
char filename[PATH_MAX];
FILE *file;
snprintf(filename, sizeof(filename), "/sys/class/gpio/gpio%d/edge", n);
#
# mlib: common client js routines v0.5.0
# m@penzin.ru
#
# -- globals --
window.lib = x = {}
# window._csrf used as token, replaced by _csrf cookie if empty
@maxp
maxp / arduino_ds1820.ino
Created December 13, 2014 15:09
Read single DS1820 temperature sensor.
//
// http://playground.arduino.cc/Learning/OneWire
//
#include <OneWire.h>
#define ONEWIRE_PIN 2
OneWire ds(ONEWIRE_PIN);
Y = 0.21*R + 0.72*G + 0.07*B > 80% for light background
https://events.yandex.ru/lib/talks/2491/
(7:38)
@maxp
maxp / xorg.conf
Created May 24, 2009 13:54
xorg.conf
#
# xorg.conf @ black
#
#Section "Device"
# Identifier "aticonfig-Device[0]"
# Driver "fglrx"
## Driver / Performance Options
# Option "XAANoOffscreenPixmaps" "true"
# Option "TexturedVideo" "On"