Skip to content

Instantly share code, notes, and snippets.

View asakasinsky's full-sized avatar

Vasily Asakasinsky asakasinsky

View GitHub Profile
@asakasinsky
asakasinsky / sms_pdu.py
Created April 22, 2014 13:05
Python script to send sms via Siemens CX65 with Prolific PL2303 USB-to-Serial port adapter. Source: http://habrahabr.ru/post/58348/
#!/usr/bin/python
# COM-port settings
# Add this string
# KERNEL=="ttyUSB[0-9]", RUN+="/bin/stty -F /dev/%k speed 9600 -brkint -icrnl ixoff -imaxbel -opost -onlcr -isig -icanon -echo -echoe"
# in /etc/udev/rules.d/50-udev.rules
import os
import sys
@asakasinsky
asakasinsky / guafal.sh
Last active August 29, 2015 14:04
Gather Unique User-Agents from access_log
#!/bin/bash
# GUAFAL
# Gather User-Agents From Access Log
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ "$1" == "" ]; then
echo "Sorry, i need an access_log path."
exit 1
fi
<?php
/**
* Formats a JSON string for pretty printing
*
* @param string $json The JSON to make pretty
* @param bool $html Insert nonbreaking spaces and <br />s for tabs and linebreaks
* @return string The prettified output
* @author Jay Roberts
*/
@asakasinsky
asakasinsky / REST.md
Last active August 29, 2015 14:06 — forked from jstnjns/REST.md

Request

HTTP Methods

POST

  • Without ID will create a new item in a collection, and return that new item
  • Without ID, with reference_id in payload will create a new item in a collection with the same attributes as the item with a matching id as the reference_id (and use any other attributes in payload as overrides), and return that new item (cloning)
  • With an ID will return error code 405
@asakasinsky
asakasinsky / dnsdiff.py
Last active August 29, 2015 14:09 — forked from finnigja/dnsdiff.py
#!/usr/bin/env python
#
# DNS Result Comparison Utility
# Author: https://twitter.com/chair6
#
import argparse
import dns.resolver
import dns.rdatatype
from collections import defaultdict
function trim(c) {
var ctx = c.getContext('2d'),
copy = document.createElement('canvas').getContext('2d'),
pixels = ctx.getImageData(0, 0, c.width, c.height),
l = pixels.data.length,
i,
bound = {
top: null,
left: null,
right: null,
u.ease = {
quadratic: {
style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
fn: function (k) {
return k * ( 2 - k );
}
},
circular: {
style: 'cubic-bezier(0.1, 0.57, 0.1, 1)', // Not properly "circular" but this looks better, it should be (0.075, 0.82, 0.165, 1)
fn: function (k) {
u.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
var distance = current - start,
speed = Math.abs(distance) / time,
destination,
duration;
deceleration = deceleration === undefined ? 0.0006 : deceleration;
destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
duration = speed / deceleration;
.b-scroller {
position:absolute;
z-index: 200;
width: 100%;
height: 100%;
padding:0;
overflow: hidden;
background: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
/*global Scroller: true */
/*global utils: true */
/*global Touch: true */
(function(window, document, Math, Zepto)
{
"use strict";
var defaults =
{