Skip to content

Instantly share code, notes, and snippets.

@fernandoaleman
fernandoaleman / Linux Static IP
Created March 23, 2012 16:20
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
def Object.create(attrs)
obj = new
obj.singleton_class.send(:attr_accessor, *attrs.keys)
attrs.each do |name,value| obj.instance_variable_set(name.to_s.sub(/\A@?/, '@'), value) end
obj
end
o = Object.create(foo: 12, bar: "hi") # => #<Object:0x007fc53a0f7bc8 @bar="hi", @foo=12>
o.bar # => "hi"

Performance of Flask, Tornado, GEvent, and their combinations

Wensheng Wang, 10/1/11

Source: http://blog.wensheng.org/2011/10/performance-of-flask-tornado-gevent-and.html

When choosing a web framework, I pretty much have eyes set on Tornado. But I heard good things about Flask and Gevent. So I tested the performance of each and combinations of the three. I chose something just a little more advanced than a "Hello World" program to write - one that use templates. Here are the codes:

1, Pure Flask (pure_flask.py)

<?php
require_once './MethodSuggestion.php';
class SampleClass extends ArrayObject
{
// Your code here ...
/**
* Add 3 lines as below to use method suggestion
*/
@j4rs
j4rs / instagram.rb
Last active August 5, 2020 20:16
Integrating Instagram(OAuth) using RubyMotion, Promotion, AFMotion and some SugarCube
class Instagram < PM::WebScreen
title "Instagram"
CLIENT_ID = 'your client id'
REDIRECT_URI = 'http://your.domain.com/auth/instagram/callback'
FAILURE_URL = 'http://your.domain.com/auth/failure'
AUTH_URI = "https://instagram.com/oauth/authorize/?client_id=#{CLIENT_ID}&redirect_uri=#{REDIRECT_URI}&response_type=token"
class << self
def api
class CategoryCell < UITableViewCell
def rmq_build
rmq(self.contentView).tap do |q|
# Add your subviews, init stuff here
# @foo = q.append(UILabel, :foo).get
#
# Or use the built-in table cell controls, if you don't use
# these, they won't exist at runtime
# q.build(self.imageView, :cell_image)
@timf
timf / hiring.md
Last active January 18, 2020 22:11
Hiring!

See the more recent gist.

Hiring!

The Dell Cloud Manager engineering team is growing. We're looking for seven new software developers at many different experience levels.

In this gist, I want to give you an idea of:

public Bitmap blurBitmap(Bitmap bitmap){
//Let's create an empty bitmap with the same size of the bitmap we want to blur
Bitmap outBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
//Instantiate a new Renderscript
RenderScript rs = RenderScript.create(getApplicationContext());
//Create an Intrinsic Blur Script using the Renderscript
ScriptIntrinsicBlur blurScript = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('image.jpg', cv2.IMREAD_GRAYSCALE)
def compute_skew(image):
image = cv2.bitwise_not(image)
height, width = image.shape