Skip to content

Instantly share code, notes, and snippets.

@ryenus
ryenus / cygup.bat
Created March 12, 2011 02:26
Update Cygwin installer and the packages with a one-click batch script
@echo off
echo Checking for the latest cygwin installer
wget -N -nv --no-cache http://www.cygwin.com/setup.exe
start setup.exe -n -M -A >NUL 2>&1
Originally:
https://gist.github.com/7565976a89d5da1511ce
Hi Donald (and Martin),
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I
appreciate the tone. This is a Yegge-long response, but given that you and
Martin are the two people best-situated to do anything about this, I'd rather
err on the side of giving you too much to think about. I realize I'm being very
critical of something in which you've invested a great deal (both financially
@ryenus
ryenus / gist:1518596
Created December 25, 2011 01:15
Using ruby in place of grep/awk/sed like perl

With options -e, -n, -p, perl can do what grep/awk/sed can, what about ruby?

Let's take the result of ls -l as input and process it with ruby

grep with ruby

\ls -l | ruby -ne 'print if /^d/'

awk with ruby

\ls -l | ruby -ne 'puts split(/\s+/).last if /^d/'

@ryenus
ryenus / file-url-rants.md
Created January 29, 2012 05:01
Using local pac script in IE 9

This is interesting, How come IE (version 9) still doesn't support proper file:// urls for local pac script?

  • file:///C:/my.pac doesn't work.
  • file://C:/my.pac works.

This is even more interesting because, back in 2006, someone (very likely from inside Microsoft) has already(!) clarifed the correct usage of file:// on the official IEBlog, and here. Another good reference is from our beloved Wikipedia.

Dear MS, please fix this, so that I can use consistent pac script urls across browsers, and stop slapping your own face. Thank you!

@ryenus
ryenus / TestRubyDir.java
Created February 12, 2012 14:22
JUnit 4 test for JRUBY-6267
package org.jruby.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;
import java.nio.charset.Charset;
import org.jruby.CompatVersion;
import org.jruby.Ruby;
import org.jruby.RubyDir;
@ryenus
ryenus / .screenrc
Created March 14, 2012 13:22
rns-screenrc
# Set the default window name to empty string instead of the arbitrary "bash"
#shelltitle '% |bash'
shell -bash
#termcapinfo xterm* ti@:te@
term xterm
#term screen-256color
#escape ^Bb # Instead of Control-a, make the escape/command character be Control-b
# Set the window caption.
@ryenus
ryenus / config
Created March 14, 2012 18:24
local .git/config for http://rjb.rubyforge.org/svn
[core]
repositoryformatversion = 0
bare = false
logallrefupdates = true
ignorecase = true
[svn-remote "svn"]
url = http://rjb.rubyforge.org/svn
fetch = trunk:refs/remotes/trunk
tags = /{1.1.1,1.1.2,1.1.3,1.1.4,1.1.5,1.1.6,1.1.7,1.1.8,rjb-1.1.9,1.2.0,1.2.1,1.2.2,1.2.3,1.2.4,1.2.5,rjb-1.2.6,1.2.7,1.2.8,1.2.9,1.3.0,1.3.1,1.3.2,1.3.3,1.3.4,1.3.4a,1.3.5,1.3.6,1.3.7,1.3.8}:refs/remotes/tags/*
@ryenus
ryenus / settings.xml
Created March 28, 2012 01:06
maven mirror setup
<!--
- m.g.o-public (http://maven.glassfish.org/content/groups/public/) is down
- replace it with maven.jenkins-ci.org (http://maven.jenkins-ci.org/content/groups/artifacts)
-->
<mirrors>
<mirror>
<id>maven.jenkins-ci.org</id>
<mirrorOf>m.g.o-public</mirrorOf>
<url>http://maven.jenkins-ci.org/content/groups/artifacts</url>
</mirror>
@ryenus
ryenus / gist:2392592
Created April 15, 2012 12:46
A regular expression to check for prime numbers
# see http://www.noulakaz.net/weblog/2007/03/18/a-regular-expression-to-check-for-prime-numbers/
/^1?$|^(11+?)\1+$/
@ryenus
ryenus / gist:2634682
Created May 8, 2012 12:54
git delete/fetch remote reference
# delete a remote reference
git branch -r -d <remote/ref>
# e.g.
git branch -r -d origin/master
# fetch a remote reference
git fetch <upstream-remote> :[refs/]remotes/<remote/ref>
# e.g.
git fetch origin :refs/remotes/origin/master
git fetch origin :remotes/origin/master