Skip to content

Instantly share code, notes, and snippets.

View dallarosa's full-sized avatar

Francisco Dalla Rosa Soares dallarosa

View GitHub Profile
@dallarosa
dallarosa / login.xml
Created May 16, 2011 03:13
login layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:text="@string/userid"
android:id="@+id/useridtext"
android:layout_height="wrap_content"
[{"tell":{"created_at":"2011-06-07T12:04:11Z","channel_id":3,"updated_at":"2011-06-07T12:04:11Z","text":"asdasdasgdsg","id":16,"handle_id":4}}]
@dallarosa
dallarosa / gist:1024126
Created June 14, 2011 01:15
Failing to use rake db
$ rake db:reset --trace
rake aborted!
undefined method `task' for #<FiveTalk::Application:0xb77bd510>
/usr/local/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'
/usr/local/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:139:in `load_tasks'
/usr/local/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:77:in `send'
/usr/local/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
/home/develop/0523a/fivetalk/Rakefile:7
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load_rakefile'
@dallarosa
dallarosa / gist:1099039
Created July 22, 2011 07:45
Unicorn stack trace
I, [2011-07-22T16:38:28.983784 #21818] INFO -- : unlinking existing socket=/tmp/.5talk
I, [2011-07-22T16:38:28.984138 #21818] INFO -- : listening on addr=/tmp/.5talk fd=3
I, [2011-07-22T16:38:28.984598 #21818] INFO -- : listening on addr=0.0.0.0:8080 fd=5
I, [2011-07-22T16:38:28.985221 #21818] INFO -- : Refreshing Gem list
*** glibc detected *** unicorn_rails worker[0] -c config/unicorn.rb -D: malloc(): memory corruption: 0x08ecf770 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6(+0x6aaa1)[0xb76b4aa1]
/lib/i686/cmov/libc.so.6(+0x6d884)[0xb76b7884]
/lib/i686/cmov/libc.so.6(__libc_malloc+0x5c)[0xb76b948c]
*** glibc detected *** unicorn_rails master -c config/unicorn.rb -D: malloc(): memory corruption: 0x08ecf758 ***
@dallarosa
dallarosa / gist:1257520
Created October 2, 2011 15:01
excerpt of iwconfig man file
key/enc[ryption]
Used to manipulate encryption or scrambling keys and security mode.
To set the current encryption key, just enter the key in hex digits as XXXX-XXXX-XXXX-XXXX or XXXXXXXX. To set a key other than the current
key, prepend or append [index] to the key itself (this won't change which is the active key). You can also enter the key as an ASCII string
by using the s: prefix. Passphrase is currently not supported.
To change which key is the currently active key, just enter [index] (without entering any key value).
off and on disable and reenable encryption.
The security mode may be open or restricted, and its meaning depends on the card used. With most cards, in open mode no authentication is
used and the card may also accept non-encrypted sessions, whereas in restricted mode only encrypted sessions are accepted and the card will
use authentication if available.
@dallarosa
dallarosa / gist:1526948
Created December 28, 2011 07:25
fragment
package me.movamova;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
public class FeedFragment extends Fragment {
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="letstalktech.org" android:pathPrefix="public/article.php"/>
</intent-filter>
@dallarosa
dallarosa / gist:2155000
Created March 22, 2012 01:22
awk one-liner that takes a comma-separated list of username followed by names and creates links to each user's address.
awk -F", " '{print "<li><a href=\"http://example.com/~"$1"\">"$2"</a></li>"}'
@dallarosa
dallarosa / int_rotation.py
Created April 16, 2012 01:43
Integer circular shift
def rotate(x,n):
result = x
mag_x = len(str(x))
for i in range(0,n):
mag_res = len(str(result))
first = 0 if mag_x > mag_res else int(result/pow(10,mag_res))
tmp = result - first*pow(10,mag_res)
result = tmp*10 + first
return result
@dallarosa
dallarosa / readinput.c
Created April 16, 2012 10:07
read input boilerplate
scanf("%d\n", &test_count);
for (i = 0; i < test_count; i++) {
scanf("%d %d", &A, &B);
/* now you got A and B*/