This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate ssh2; | |
use std::net::TcpStream; | |
use std::path::Path; | |
use std::io::BufWriter; | |
use ssh2::Session; | |
use ssh2::{OpenType, WRITE, TRUNCATE}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate ssh2; | |
use std::net::TcpStream; | |
use ssh2::Session; | |
fn create_session() -> Session { | |
let tcp = TcpStream::connect("test:22").expect("Cannot connect"); | |
let mut sess = Session::new().expect("cannot start session"); | |
sess.handshake(&tcp).expect("handshake failed"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::Read; | |
use std::time::Instant; | |
use std::io::Result; | |
use std::io::{Error, ErrorKind}; | |
use std::cmp; | |
pub struct UploadData { | |
pub total_data_size: u64, | |
pub timeout_in_sec: u64, | |
pub start_time: Instant, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_use] | |
extern crate nickel; | |
extern crate rustc_serialize; | |
extern crate scan_dir; | |
extern crate csv; | |
use std::ops::Deref; | |
use std::collections::BTreeMap; | |
use std::collections::HashMap; | |
use std::{thread, time}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import thread | |
from Queue import Queue | |
from collections import deque | |
import time | |
from bottle import route, run, template | |
from daemonizer import Daemonizer | |
MAX_Q_LENGTH = 60 # rolling avg for a minute |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <nan.h> | |
#include <random> | |
#include <uv.h> | |
uv_loop_t *loop; | |
uv_async_t async; | |
using namespace v8; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# extend non-HiDPI external display on DP* above HiDPI internal display eDP* | |
# see also https://wiki.archlinux.org/index.php/HiDPI | |
# you may run into https://bugs.freedesktop.org/show_bug.cgi?id=39949 | |
# https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/883319 | |
EXT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^eDP | head -n 1` | |
INT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^DP | head -n 1` | |
ext_w=`xrandr | sed 's/^'"${EXT}"' [^0-9]* \([0-9]\+\)x.*$/\1/p;d'` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is work by Mike Stay, (http://jscategory.wordpress.com/source-code/) | |
// I place all this code in the public domain. | |
// Library of contracts and functors. | |
var CT = (function (){ | |
var call = Function.prototype.call; | |
var slice = call.bind([].slice); | |
var getClassName = call.bind({}.toString); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gevent import monkey | |
monkey.patch_socket() | |
import logging | |
import gevent | |
from gevent.queue import Queue | |
import pymysql as db | |
logging.basicConfig(level=logging.DEBUG) | |
LOGGER = logging.getLogger("connection_pool") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#script extraido de: http://paulocassiano.wordpress.com/2008/08/29/deixando-o-gedit-com-a-cara-do-textmate/ | |
#tip for better "resolution" here: http://blog.siverti.com.br/2008/05/22/fonte-monaco-no-ubuntugedit/ | |
cd /usr/share/fonts/truetype/ | |
#TODO: put validation if folder already exists | |
sudo mkdir ttf-monaco |