Skip to content

Instantly share code, notes, and snippets.

View sosnovskyas's full-sized avatar

Alexey Sosnovsky sosnovskyas

View GitHub Profile
# QEmu
brew install qemu
# Home for out tests
mkdir ~/arm-emu
cd ~/arm-emu
# Download initrd and kernel
wget http://ftp.de.debian.org/debian/dists/jessie/main/installer-armel/current/images/versatile/netboot/initrd.gz
@sosnovskyas
sosnovskyas / jwtRS256.sh
Created July 19, 2018 12:58 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@sosnovskyas
sosnovskyas / drag-n-drop.html
Created March 16, 2018 08:53
Пример простого drag'n'drop
<html>
<head>
<style>
body {
position: relative;
}
.cube {
position: absolute;
left: 100px;
top: 100px;
@sosnovskyas
sosnovskyas / gist:1c2675abd63635a9742b6e3cb285cd87
Created February 20, 2018 07:20
tiny10: Fade PB0 and PB1 up and down using PWM
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
int i;
// PB0 and PB1 outputs
DDRB = (1<<PB0) | (1<<PB1);
@sosnovskyas
sosnovskyas / gist:5d9637116c2a66ff4d35e7083518e0f2
Created February 20, 2018 07:20
tiny10: Fade PB0 and PB1 up and down using PWM
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
int i;
// PB0 and PB1 outputs
DDRB = (1<<PB0) | (1<<PB1);
@sosnovskyas
sosnovskyas / main.c
Created February 20, 2018 07:07
ATtiny 5/10: Read ADC2 (PB2) and output servo PWM signal on PB0 and PB1
/*
Read ADC2 (PB2) and output servo signal on PB0 and PB1.
ATtiny5 or 10 at default 1MHz.
*/
#include <avr/io.h>
int main(void)
{
// ADC channel 2
@sosnovskyas
sosnovskyas / EcmaStandart Перевод 11.9.3.txt
Created June 5, 2017 10:45 — forked from egrashinagi/EcmaStandart Перевод 11.9.3.txt
EcmaStandart Перевод 11.9.3 The Abstract Equality Comparison Algorithm
Алгоритм сравнения
Сравнение x==y , где x и y значения представляют true or false. Эти значения выполнены следующим образом:
1. Если Тип X такой же как тип Y, тогда:
a. Если Тип X undefined возвращает true.
b. Если Тип X Null возвращает true.
c. Если Тип X number тогда
i. если X NaN возвращает false.
ii. если Y NaN возвращает false.
iii.Если X такой же как Number и значение Y возвращает true.
iv. Если X +0 и Y -0 возвращает true.
@sosnovskyas
sosnovskyas / genMonth
Last active December 22, 2016 14:01
generate month (генерация месяца)
const generateMonth = (date) => {
const getLocalDay = (date) => {
// конвертация в европейскую неделю
let day = date.getDay();
if (day == 0) { // день 0 становится 7
day = 7;
}
return day;
@sosnovskyas
sosnovskyas / guid-update.js
Last active September 5, 2016 20:36
re-generate guid's in file
var fs = require('fs');
var guid = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/ig;
var inputFile = 'input.json';
var outputFile = 'result.json';
// читаем
fs.readFile(inputFile, 'utf8', function (err,data) {
if (err) {
return console.log(err);
@sosnovskyas
sosnovskyas / app.js
Created December 7, 2015 10:02 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');