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' |
# 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 |
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 |
# 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) |
## 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 |
In August 2007 a hacker found a way to expose the PHP source code on facebook.com. He retrieved two files and then emailed them to me, and I wrote about the issue:
http://techcrunch.com/2007/08/11/facebook-source-code-leaked/
It became a big deal:
http://www.techmeme.com/070812/p1#a070812p1
The two files are index.php (the homepage) and search.php (the search page)
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:
# 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) | |
# |