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::thread; | |
use std::net::TcpStream; | |
fn check_open_port(host: &str, port: u16) -> bool { | |
TcpStream::connect((host, port)).is_ok() | |
} | |
fn main() { | |
const PORT : u16 = 22; |
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 rustc_serialize; | |
use std::collections::HashMap; | |
use rustc_serialize::{Encodable, Encoder}; | |
use rustc_serialize::json; | |
#[derive(RustcEncodable, PartialEq, Eq, Hash, Debug)] | |
struct Point { | |
x: u64, |
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
# Python 3! | |
import random | |
def show(board): | |
print('+---+') | |
print('|%s|' % board[0:3]) | |
print('|%s|' % board[3:6]) | |
print('|%s|' % board[6:9]) | |
print('+---+') |
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
#!/usr/bin/env python | |
from sys import argv, exit | |
from time import sleep, time | |
import re | |
if len(argv) != 2: | |
print('Usage: nap <interval>') | |
print('Where: <interval> is <num>h hours') |
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 | |
# Example usage: | |
# | |
# foreach '*.cs' grep foo | |
find . -iname "$1" -print0 | xargs -0 ${@:2} |
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 | |
# License: Public Domain. | |
# Author: Joseph Wecker, 2012 | |
# | |
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile? | |
# Are you tired of trying to remember how darwin/mac-osx treat them differently from linux? | |
# Are you tired of not having your ~/.bash* stuff work the way you expect? | |
# | |
# Symlink all of the following to this file: | |
# * ~/.bashrc |
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
(ns tetris | |
(:import | |
(javax.swing JFrame) | |
(java.awt Canvas Graphics Dimension Color Polygon GraphicsEnvironment Transparency Toolkit) | |
(java.awt.image BufferStrategy BufferedImage PixelGrabber WritableRaster) | |
(java.awt.event ActionListener KeyListener KeyEvent)) | |
(:gen-class)) | |
(def *cols* 10) | |
(def *rows* 20) |