Skip to content

Instantly share code, notes, and snippets.

View h4's full-sized avatar
💭
I may be slow to respond.

Mikhail Baranov h4

💭
I may be slow to respond.
View GitHub Profile
@meritt
meritt / beautify.coffee
Last active December 18, 2015 16:49
Twitter Streaming API v1.1 + node.js + socket.io
twitter = require 'twitter-text'
module.exports = (tweet) ->
# Преобразуем только ссылки, хештеги и аккаунты оставляем текстом
text = twitter.autoLinkUrlsCustom tweet.text, target: '_blank'
# Заменяем сжатые ссылки на нормальные
if tweet.entities.urls? and tweet.entities.urls.length > 0
for entity in tweet.entities.urls
text = text.replace entity.url, entity.expanded_url
@manis404
manis404 / gist:5427116
Created April 20, 2013 19:38
Rpi Hardware h264 encode/decode
echo "deb http://vontaene.de/raspbian-updates/ . main" >> /etc/apt/sources.list
apt-get update
apt-get install libgstreamer1.0-0 libgstreamer1.0-0-dbg libgstreamer1.0-dev liborc-0.4-0 liborc-0.4-0-dbg liborc-0.4-dev liborc-0.4-doc gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gstreamer1.0-alsa gstreamer1.0-doc gstreamer1.0-omx gstreamer1.0-plugins-bad gstreamer1.0-plugins-bad-dbg gstreamer1.0-plugins-bad-doc gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-base-dbg gstreamer1.0-plugins-base-doc gstreamer1.0-plugins-good gstreamer1.0-plugins-good-dbg gstreamer1.0-plugins-good-doc gstreamer1.0-plugins-ugly gstreamer1.0-plugins-ugly-dbg gstreamer1.0-plugins-ugly-doc gstreamer1.0-pulseaudio gstreamer1.0-tools gstreamer1.0-x libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-bad1.0-dev libgstreamer-plugins-base1.0-0 libgstreamer-plugins-base1.0-dev
if pgrep gst-launch
then
pkill gst-launch
else
DIR=`date "+%Y-%m-%d-%H:%M:%S"`
mkdir $DIR
gst-launch \
flvmux name=camera ! filesink location="$DIR/camera.flv" \
flvmux name=screen ! filesink location="$DIR/screen.flv" \
\
@pepelsbey
pepelsbey / .bash_profile
Created November 3, 2012 05:16
SVG to SVGZ and back
# Functions
svgz() {
gzip $1 -S z
}
svg() {
file=$1
name=${file%.*}
mv ${file} ${name}.svg.gz && gunzip ${name}.svg.gz
}
@miripiruni
miripiruni / wishlist.md
Last active October 12, 2015 03:47 — forked from pepelsbey/wishlist.md
Список желаний
@h4
h4 / uri.js
Created September 6, 2012 10:12 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@pepelsbey
pepelsbey / wishlist.md
Last active October 8, 2015 14:58
Список желаний

Список желаний

Ведётся для друзей (что тебе подарить?) и для себя (куда бы потратить деньги?). Если вы хотите меня порадовать, то можете купить что-нибудь из списка ниже или просто перевести мне денег в качестве комплимента. Перед тем, как что-либо купить, сообщите мне о своём намерении, чтобы не было пересечений в сезонные подарочные периоды. Исключение составляет только список «Прочее».

Книги

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@armonge
armonge / gist:2830057
Created May 29, 2012 19:04
django youtube field
import urlparse
import re
from django.db import models
from django import forms
def validate_youtube_url(value):
'''El patron lo saque de http://stackoverflow.com/questions/2964678/jquery-youtube-url-validation-with-regex'''
pattern = r'^http:\/\/(?:www\.)?youtube.com\/watch\?(?=.*v=\w+)(?:\S+)?$'