Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/ruby
class String
# Renvoie la première lettre d'une chaine
def head
nil
self[0].chr unless self.empty?
end
# Renvoie la chaîne moins son premier caractère
#!/usr/bin/env ruby -W
# encoding: utf-8
require 'set'
pattern = ARGV.shift
exit 1 if pattern.nil?
root_pattern = File.join(Dir.getwd, '**', pattern)
Test Case '-[TestQSObject testEquality]' started.
2016-03-23 16:06:29.880 xctest[72805:4013708] test combined 1st
2016-03-23 16:06:29.881 xctest[72805:4013708] building set: {(
"public.utf8-plain-text",
"public.data"
)}
2016-03-23 16:06:29.881 xctest[72805:4013708] type: public.utf8-plain-text, adding: (
"string data"
) to (
)
#!/usr/bin/env ruby -W
# encoding: utf-8
# This script takes a glob pattern as input (eg. "*.[hm]"), and reports
# indentation statistics for files matching the pattern in the current
# directory, recursively.
require 'set'
pattern = ARGV.shift
@tiennou
tiennou / LICENSE
Last active August 30, 2016 15:39
A better-behaved getopt replacement
Copyright (c) 2016, Etienne Samson
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
#!/usr/bin/env ruby -W
require 'pp'
require 'ostruct'
$global_stats = {
file_count: 0,
line_count: 0,
space_indent: 0,
#!/bin/sh
file="$1"
shift
clang-format $file | diff -U5 $file -
@tiennou
tiennou / crashreport.rb
Created April 17, 2017 17:00
QS Crash report wrangler
# A Ruby module for OS X crash-report-wrangling
#
# https://developer.apple.com/library/content/technotes/tn2004/tn2123.html
require 'digest/md5'
require 'shellwords'
$debug = false
def debug(str)
@tiennou
tiennou / zalgolizer.rb
Created May 18, 2017 22:38
A Ruby command line tool for your zalgo needs
#!/usr/bin/env ruby -w
# encoding: utf-8
require 'optparse'
options = {}
OptionParser.new do |opts|
opts.banner = "#{File.basename($0)} [-dz] [string to zalgo|-]"
opts.on "-d", "--debug", "Debug mode" do |v| options[:debug] = v; end
-- The C compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found