Skip to content

Instantly share code, notes, and snippets.

View eggie5's full-sized avatar
💭
Working on TensorFlow Ranking

Alex Egg eggie5

💭
Working on TensorFlow Ranking
View GitHub Profile
test
$ curl http://npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5804 100 5804 0 0 1580 0 0:00:03 0:00:03 --:--:-- 1604
: command not found
sh: line 2: !DOCTYPE: No such file or directory
sh: line 3: html: No such file or directory
sh: line 4: !--: No such file or directory
sh: line 5: FileName:: command not found
sh: line 6: Language:: command not found
$ node db.js
events:63
this.emit("newListener", type, listener);
^
TypeError: Object #<an Object> has no method 'emit'
at events:63:8
at EventEmitter.Connection (/Users/eggie5/Development/tapioca/dd/lib/postgres-js/lib/postgres-pure.js:304:3)
at onLoad (/Users/eggie5/Development/tapioca/dd/db.js:9:12)
var sys=require('sys');
var mamlib=require('./mammal');
console.log(sys.inspect(mamlib));
=> {}
WHY???
var app = require('express').createServer();
cs="postgres://asdf:@localhost/dogs"
var postgres = require('./lib/postgres-js/lib/postgres-pure');
var db = new postgres.Connection(cs);
app.get('/dd', function(req, res){
db.query("SELECT * FROM dogs;", function (data) {
res.send(JSON.stringify(data), { 'Content-Type': 'application/json' }, 200);
});
ext = Service.new(:url=> "fake url")
dog = ext.Dog.get_all
cat = ext.Cat.get_all
black_dog = ext.Dog.new(:color=>"black")
black_dog.save()
@eggie5
eggie5 / b64.java
Created December 18, 2010 21:56
encode arbitrary file to base64 string (java)
String s= new String();
int BUFFER_SIZE = 4096;
byte[] buffer = new byte[BUFFER_SIZE];
InputStream input = new FileInputStream(args[0]);
OutputStream output = new Base64OutputStream(new FileOutputStream(args[1]));
int n = input.read(buffer, 0, BUFFER_SIZE);
while (n >= 0) {
output.write(buffer, 0, n);
n = input.read(buffer, 0, BUFFER_SIZE);
private void sendpic(String data_string) {
try {
String xmldata = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<photo><photo>" + data_string + "</photo></photo>";
// Create socket
String hostname = "http://eggie5.com";
String path = "/a";
int port = 80;
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.eggie5"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".post_to_eggie5"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
$ pg_ctlcluster 9.0 eggmos start
The PostgreSQL server failed to start. Please check the log output:
2011-02-01 11:41:05 PST LOG: database system was shut down at 2011-02-01 11:39:39 PST
2011-02-01 11:41:05 PST LOG: entering standby mode
cp: cannot stat `/var/lib/postgresql/9.0/eggmos/backups/000000010000000100000032': No such file or directory
2011-02-01 11:41:05 PST WARNING: WAL was generated with wal_level=minimal, data may be missing
2011-02-01 11:41:05 PST HINT: This happens if you temporarily set wal_level=minimal without taking a new base backup.
2011-02-01 11:41:05 PST FATAL: hot standby is not possible because wal_level was not set to "hot_standby" on the master server
2011-02-01 11:41:05 PST HINT: Either set wal_level to "hot_standby" on the master, or turn off hot_standby here.
2011-02-01 11:41:05 PST LOG: startup process (PID 20724) exited with exit code 1