Skip to content

Instantly share code, notes, and snippets.

View windwiny's full-sized avatar

windwiny windwiny

View GitHub Profile
@windwiny
windwiny / fork.c
Created March 28, 2017 13:00 — forked from Cr4sh/fork.c
fork() for Windows
/*
* fork.c
* Experimental fork() on Windows. Requires NT 6 subsystem or
* newer.
*
* Copyright (c) 2012 William Pitcock <nenolod@dereferenced.org>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
@windwiny
windwiny / mutex.sh
Last active May 16, 2017 14:24
shell create pid file , avoid script running multiple times
#!/bin/sh
## create pid file , avoid script running multiple times
### every script gen a unique UUID
UUID=ACD35429D76148978480EA945653D112
pid_file=/tmp/${UUID}.pid
if [[ -f $pid_file ]]; then
lpid=$(head -1 $pid_file)
if [[ ! -z $lpid ]]; then
#!/usr/bin/env ruby
require 'pp'
require 'optparse'
options = {:can_skip_newerbundle=>true}
OptionParser.new do |opts|
opts.banner = "Usage: gem-ext-compile-v2.rb [options]"
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
options[:verbose] = v
@windwiny
windwiny / rbexcel.rb
Created November 1, 2021 16:45
ruby win32old on excel, replace VBA
#!/usr/bin/env ruby
=begin
Use ruby/win32ole on excel application, replace VBA
=end
require 'pry'
require 'tk'
if Gem.win_platform?
require 'win32ole'
#!/usr/bin/env ruby
=begin
ruby win32ole common functions
OLE excel object: Application, Workbook, Worksheet, Range, Cells , ...
Demo howto find them, get/set value/style
used other ruby script import it:
require 'rbexcelbase' # copy this to C:\ruby2\lib\ruby\2.3.0\rbexcelbase.rb or