Skip to content

Instantly share code, notes, and snippets.

View NicholasTD07's full-sized avatar

Nicholas T. NicholasTD07

  • Sydney, Australia
View GitHub Profile
@NicholasTD07
NicholasTD07 / .vimrc
Created April 13, 2012 04:16 — forked from ninehills/.vimrc
VIMRC
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 一般设定
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 设定主题
colo evening
" 设定默认解码
set fenc=utf-8
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936
#!/bin/sh
# Warning!
# if you DIY a stage package like this,
# you must use the Stage3`s /etc/udev/*
# or rm /etc/udev/rules.d/70*
# Warning!
# last edited by likuku on 2012.03.29
DATE=`date +%Y_%m_%d_%H_%M_%S`
ARCH=`uname -m`
# Using this script downloads ALL the videos in NSScreencast.
# Use it wisely, it's extra load/bandwidth for the NSScreencast website.
# Usage: `EMAIL=your email PASSWORD=your password END=how many videos should be downloaded? ruby download-nsscreencast.rb`
require "mechanize"
require "parallel"
mechanize = Mechanize.new
mechanize.post("https://www.nsscreencast.com/user_sessions", {"email" => ENV["EMAIL"], "password" => ENV["PASSWORD"]})
mechanize.pluggable_parser.default = Mechanize::Download
static func getPrimes(to n: Int) -> [Int] {
let xmody = (1...n)
.map { x in (1...n).map { y in x % y } }
let primes = xmody
.map { mods in
mods.enumerate()
.filter { y, mod in mod == 0 }
.map { y, mod in y + 1 } // divisors for x
}