Skip to content

Instantly share code, notes, and snippets.

View wunki's full-sized avatar
🏠
Working from my home in the Netherlands.

Petar Radošević wunki

🏠
Working from my home in the Netherlands.
View GitHub Profile
module Main where
import System.Environment (getArgs)
import qualified Data.ByteString.Lazy as L
import Data.Word
addBytes :: [Word8] -> Word8
addBytes [] = 0
addBytes (x:xs) = x + addBytes xs
module Main where
import System.Environment (getArgs)
import qualified Data.ByteString.Lazy as L
import Data.Word
{-
- Test to see how fast we can process an 1GB binary file.
- From the blog post: http://jvns.ca/blog/2014/05/12/computers-are-fast/
-
-- name: fetch-students-for-user
-- Returns all the students for this user
SELECT *
FROM users
WHERE id IN
(SELECT user_id FROM students WHERE flow_id IN
(SELECT id FROM flows WHERE owner_id = :user_id))
#[crate_id="cherr"]
use std::os;
use std::io::fs;
fn main() {
// get the filename
let args = os::args();
let filename: &str = args.get(1).as_slice();
extern crate crypto = "rust-crypto";
use std::os;
struct Keys {
AccessKey: String,
SecretKey: String,
}
pub fn env_keys() -> Option<Keys> {
fn sign(req: RequestWriter, path: &Path) -> String {
let mut hmac = hmac::Hmac::new(sha1::Sha1::new(), "foo".as_bytes());
string_to_sign(hmac, req, path);
hmac.result().code().to_base64(URL_SAFE)
}
// See: http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html
// The string to sign consists of the following data:
// StringToSign = HTTP-Verb + "\n" +
// Content-MD5 + "\n" +
package main
import (
"database/sql"
"encoding/json"
"fmt"
"log"
"os"
"os/signal"
"syscall"
readers_last_week = Reader.objects\
.filter(completed_at__range=(previous_monday,
previous_sunday)).count()\
.distinct('user')\
.count()
### Keybase proof
I hereby claim:
* I am wunki on github.
* I am wunki (https://keybase.io/wunki) on keybase.
* I have a public key whose fingerprint is 208E 44AC DB1D 9CBC AF02 DEF8 91A2 3B2C 3809 EEAF
To claim this, I am signing this object:
Compiling plugin v0.0.0 (https://github.com/reem/rust-plugin.git#9564d448)
src/lib.rs:25:36: 25:44 error: cannot convert to a trait object because trait `Error` is not object-safe [E0038]
src/lib.rs:25 fn erase(self) -> Box<Error> { box self as Box<Error> }
^~~~~~~~
note: cannot call a method (`unwrap`) with a by-value receiver through a trait object
note: cannot call a method (`erase`) with a by-value receiver through a trait object
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
src/lib.rs:2:9: 2:20 warning: lint missing_doc has been renamed to missing_docs
src/lib.rs:2 #![deny(missing_doc)]