Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'yaml'
if ARGV.size < 1
puts "Usage: github-test.rb my-project.gemspec"
exit
end
require 'rubygems'
require 'rubygems/specification'
@rdp
rdp / gist:1041503
Created June 22, 2011 23:06 — forked from anonymous/gist:1030606
imagemagick failing on pdfs windows
D:\Program Files\ImageMagick-6.6.6-Q16>wget freeldssheetmusic.org/example.pdf
--2011-06-16 17:49:06-- http://freeldssheetmusic.org/example.pdf
Resolving freeldssheetmusic.org... 69.89.31.235
Connecting to freeldssheetmusic.org|69.89.31.235|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21280 (21K) [application/pdf]
Saving to: `example.pdf'
100%[======================================>] 21,280 --.-K/s in 0.1s
a = %!app_answer 0.136 0.133 -0.002
app_erb 2.393 2.466 0.075
app_factorial 4.231 4.155 -0.076
app_fib 1.386 1.262 -0.127
app_mandelbrot 3.841 3.598 -0.231
app_pentomino 33.577 34.844 1.216
app_raise 0.919 0.912 -0.003
app_strconcat 2.487 2.583 0.079
app_tak 2.075 1.761 -0.318
app_tarai 1.469 1.461 -0.010
@rdp
rdp / close_socket.rb
Last active December 31, 2015 23:19 — forked from anonymous/close_socket.rb
require 'socket'
s = UDPSocket.new
s.bind(nil, 1234)
Thread.new { sleep 5; puts 'closing'; s.close; puts 'closed'}
puts 'if this exits with closed message, it works'
puts s.recvfrom(16)
@rdp
rdp / invisible_command.rb
Last active December 6, 2019 07:22 — forked from jarib/file.rb
require "rubygems"
require "ffi"
module WinProcess
extend FFI::Library
ffi_lib "kernel32"
ffi_convention :stdcall
class Error < StandardError
package main
import "fmt"
import "strings"
// some ruby #map type things, in golang
// mostly taken from https://groups.google.com/forum/#!topic/golang-nuts/fgaeXCUEPC4
// apparently calling this out with specific types is faster than defining it generically to use interfaces: http://comments.gmane.org/gmane.comp.lang.go.general/43076
func _map(coll []string, f func(string) string) []string {
var newColl = make([]string, len(coll))
require 'java'
class A < javax.swing.JFrame
def initialize *args
super(*args)
end
end
A.new
@rdp
rdp / evp.diff
Created March 9, 2015 21:37 — forked from anonymous/evp.diff
diff --git a/source_code/DibHelper.cpp b/source_code/DibHelper.cpp
index 4bfbd94..c8a02fe 100644
--- a/source_code/DibHelper.cpp
+++ b/source_code/DibHelper.cpp
@@ -165,7 +165,7 @@ boolean is_config_set_to_1(LPCTSTR szValueName) {
HKEY hKey;
LONG i;
i = RegOpenKeyEx(HKEY_CURRENT_USER,
- L"SOFTWARE\\screen-capture-recorder", 0, KEY_READ, &hKey);
+ L"SOFTWARE\\evp-capture", 0, KEY_READ, &hKey);
if ARGV.length != 2
puts "syntax: dir_that_has_files_that_should_be_duplicated dir_that_should_have_those_files"
exit 1
end
def all_files_in_dir dir
all_in = {}
Dir[File.expand_path(dir) + "/**/*"].each{|f| # need expand path or in windows Dir["a\b/*"] failz <sigh>
if File.file? f
filename = File.basename(f)
@rdp
rdp / seek.js
Created September 25, 2016 04:23 — forked from dannyid/seek.js
Netflix Seek
// The player
var player = netflix.cadmium.objects.videoPlayer();
// Metadata about current episode -- ID and url to get frame at a specific time
var episodeId = netflix.cadmium.metadata.getActiveVideo().episodeId;
var imgRoot = netflix.cadmium.metadata.getActiveVideo().progressImageRoot;
// Generates URL of preview image for given timestamp
function getFrame(timestamp) {
var t = Math.floor(timestamp/10000).toString(10);