Skip to content

Instantly share code, notes, and snippets.

@chathudan
chathudan / TurnServerInstallationDocumentation.md
Last active April 4, 2020 11:55
Turn Server Installation Documentation

Turn Server Installation Documentation

change the package according to your server

wget http://turnserver.open-sys.org/downloads/v3.2.4.4/turnserver-3.2.4.4-debian-wheezy-ubuntu-
mint-x86-64bits.tar.gz

tar -zxvf turnserver-3.2.4.4-debian-wheezy-ubuntu-mint-x86-64bits.tar.gz

wget http://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
__all__ = ["transform"]
__version__ = '0.3'
__author__ = 'Christoph Burgmer <[email protected]>'
__url__ = 'http://github.com/cburgmer/upsidedown'
@jamiees2
jamiees2 / astar.py
Created May 7, 2013 11:20
A* Algorithm implementation in python.
# Enter your code here. Read input from STDIN. Print output to STDOUT
class Node:
def __init__(self,value,point):
self.value = value
self.point = point
self.parent = None
self.H = 0
self.G = 0
def move_cost(self,other):
return 0 if self.value == '.' else 1
@victorcreed
victorcreed / crap
Created March 29, 2013 17:06
metaprograming in controller or dynamic controller ruby on rails or whatever
class VideosController < ApplicationController
before_filter :video, only: [:show, :edit, :update, :watch, :buy, :rent]
def update
authorize! :update, @video
if @video.update_attributes params[:video]
redirect_to @video
else
render :edit
end
end
@usahg
usahg / json_quoter.rb
Last active December 15, 2015 02:19
quotes nested values in json
# problem :
# was trying to import a 3D model in a web page in json format for use with threejs : https://github.com/mrdoob/three.js
# 3D model was exported from maya using this threejs plugin # https://github.com/mrdoob/three.js/tree/master/utils/exporters/maya
# exported json had two problems:
# 1. all of it was in one line, i.e no indents
# 2. float values inside keys were not quoted i.e stringified.
# here's the snippet, it converts the 'bad' json to 'good' ( quoted json )
@parsed = JSON.parse(Rails.root.join("app","assets","javascripts","model.js").read)
@coopermaruyama
coopermaruyama / vendor-ffmpeg-heroku
Created October 27, 2012 08:39
Install FFMpeg on heroku (Rails)
## Get FFMpeg working on heroku by building binaries using vulcan
gem install vulcan
vulcan create foo
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@toolmantim
toolmantim / 1 Readme.md
Created July 26, 2012 19:39
Minification with newlines using the Rails 3 asset pipeline

Retaining line numbers with the Rails asset pipeline

By default the Rails 3 asset pipeline uses the Uglifier gem to optimize and minify your Javascript. One of its many optimisations is to remove all whitespace, turning your Javascript into one very long line of code.

Whist removing all the newlines helps to reduce the file size, it has the disadvantage of making your Javascript harder to debug. If you've tried to track down Javascript errors in minified Javascript files you'll know the lack of whitespace does make life harder.

Luckily there is a simple solution: to configure Uglifier to add newlines back into the code after it performs its optimisations. And if you're serving your files correctly gzip'd, the newlines add only a small increase to the final file size.

You can configure Uglifier to add the newlines by setting the following in your Rails 3 config/production.rb file:

@mikhailov
mikhailov / 0. nginx_setup.sh
Last active June 29, 2024 23:43
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#