Skip to content

Instantly share code, notes, and snippets.

Tupshin Harper tupshin

Block or report user

Report or block tupshin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View get_current_datetime.rs
use openfmb_ops_protobuf::openfmb::commonmodule;
fn get_current_datetime() -> Timestamp {
let t = Utc::now();
let tq = commonmodule::TimeQuality {
clock_failure: false,
clock_not_synchronized: false,
leap_seconds_known: true,
time_accuracy: commonmodule::TimeAccuracyKind::Unspecified as i32,
};
View gist:8ed63587d7e4b151b944
pub type Body = [u8];
pub trait BodyBuilder{}
impl BodyBuilder for Body {}
pub struct Body2 {body:[u8]}
pub trait BodyBuilder2{}
impl BodyBuilder2 for Body2 {}
both fail with
View gist:c460feb13a00e8d4c957
#[repr(C, packed)]
pub struct CqlStringMap<'a> {
count:u16,
map:[u8]
}
View gist:6ec681125e98444684ef
use std::io::{BufferedReader,File};
use std::collections::BinaryHeap; //latest nightlies have switch renamed PriorityQueue to BinaryHeap
fn main() {
let n = 3u; // n longest lines.
let path = Path::new("test.txt");
let mut file = BufferedReader::new(File::open(&path));
let mut pq = BinaryHeap::new(); // note: max-heap. See above about BinaryHeap
for (i, line) in file.lines().enumerate() {
View gist:b5e7d3b652ec5fa65bbf
import com.datastax.spark.connector.cql.CassandraConnector
import org.apache.spark.{SparkContext,SparkConf}
import org.apache.spark.sql.SQLContext
import com.databricks.spark.csv._
import com.datastax.spark.connector._
object CSV2Cassandra {
def main(args: Array[String]): Unit = {
val conf = new SparkConf(true).set("spark.cassandra.connection.host", "127.0.0.1").setMaster("local")
val sc = new SparkContext("local", "test", conf)
View gist:f3335554b0db254a650e
fn send (&mut self, err: c_int, bytes: &[&[u8]]) {
assert!(self.sender.is_some());
let len = bytes.iter().fold(0, |l, b| { l + b.len()});
let header = fuse_out_header {
len: (mem::size_of::<fuse_out_header>() + len) as u32,
error: -err,
unique: self.unique,
};
as_bytes(&header, |headerbytes| {
let sender = self.sender.take_unwrap();
View gist:98822dfba21ea228e871
import java.lang.Math.sqrt
object Positioning extends App {
class Circle(val x: Double, val y: Double, val r: Double)
class Point(val x: Double, val y: Double)
run_test(new Circle(-1.0, -1.0, 1.5), new Circle(1.0, 1.0, 2.0))
run_test(new Circle(236, 67, 695.075535464), new Circle(-268, 172, 409.498473746))
View gist:3797138
extern mod std;
use std::net::tcp::connect;
use std::net::tcp::write;
use std::net::ip::v4::parse_addr;
use std::uv::global_loop;
fn main() {
let port:uint = 80;
View gist:3797112
extern mod std;
use std::net::tcp::connect;
use std::net::tcp::write;
use std::net::ip::v4::parse_addr;
use std::uv::global_loop;
fn main() {
let port:uint = 80;
View gist:3796902
extern mod std;
use std::net::tcp::connect;
use std::net::ip::v4::parse_addr;
use std::uv::global_loop;
fn main() {
let port:uint = 80;
let iotask = global_loop::get();
let ip = parse_addr("127.0.0.1");
You can’t perform that action at this time.