Skip to content

Instantly share code, notes, and snippets.

View lavir's full-sized avatar

Alex Lukyanov lavir

  • ContractMill
  • Finland
View GitHub Profile
#!/usr/bin/env ruby
require 'wiringpi'
# Sound files
open_sound = 'creaking-door.mp3'
close_sound = ''
# Initialise
io = WiringPi::GPIO.new
pin = 1 # GPIO 18
@lavir
lavir / aes_gcm_encryption.py
Created November 2, 2015 13:12 — forked from cptwunderlich/aes_gcm_encryption.py
Implemented examples from https://docs.pushbullet.com/#end-to-end-encryption in python2/3 with python-cryptography (https://cryptography.io)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from binascii import a2b_base64, b2a_base64
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import (
@lavir
lavir / README.md
Last active August 29, 2015 14:20 — forked from ngryman/README.md

intellij javascript live templates

Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.

How to

  • Go to settings.
  • Search for live templates.
  • Under the javascript section you should be able to manage your templates.
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten