Skip to content

Instantly share code, notes, and snippets.

View glurp's full-sized avatar

Abby Archer glurp

View GitHub Profile
@glurp
glurp / earthporn-to-wallpaper.rb
Last active October 30, 2020 12:31
set wallpaper from reddit EarthPorn, in ruby
#
# SCHTASKS /Create /F /TN wallpaper-from-reddit /TR "C:\usr\bin\ep.bat" /SC HOURLY
# ep.bat :
# rubyw C:\usr\bin\earthporn-to-wallpaper.rb
path="c:/usr/www/images/ep"
fr=path+"/fpersist.rb"
if ARGV.first == "delete"
puts "Delete all jpeg file in '#{path}' directories ..."
Dir.glob(path+"/*.jpg").each {|fn| File.delete(fn) }
@glurp
glurp / json_verif_pp
Created October 2, 2019 16:59
On json syntaxe error, pretty-print the fragment where the issue occure
#!/usr/bin/ruby
require 'json'
mess=File.read(ARGV.first).split(/\r?\n/).join("").gsub(/\s\s+/," ")
loop {
JSON.parse(mess) rescue break
exit(0)
}
loop {
@glurp
glurp / autoinstaller.rb
Last active December 27, 2018 22:53
Create a autoinstaller file as ruby script
#!/usr/bin/ruby
#################################################################################
# autopatch.rb : Create a autoinstallable script
#
# use 'tar czf' and base64 for serialize a directory in ascii data, embedded it in a ruby script.
# Executing this script will untar the data in current directory
#
#--------------------------------------------------------------------------------
# Create autoinstaller :
# > ruby autopatch.rb /opt/foo
@glurp
glurp / gen-style.css
Last active December 20, 2018 21:02
generation of sheat sheet documentation of ruby code
* {
font-size: small;
}
div#cols {
column-width: 20em;
column-gap: 4px;
column-rule-style: solid;
column-rule-color: #044;
}
h2,h3,h4,h5 {
@glurp
glurp / doc-exec.rb
Created December 20, 2018 12:27
execute and print ruby instructions
str=<<'EEOF'
"a,b,c,d".split(/,/)
"a,bb,c".scan(/\w+/)
[1,2,3].inspect
[1,2,3].join(",")
Hash[1,2,3,4]
h=[1,2,3,4,5,6,7,8].group_by {|v| v%4}
h.to_a()
h.keys()
h.values()
@glurp
glurp / horloge.rb
Created November 19, 2018 12:05
blague check norris , periodique
require 'ssl_certificate'
require 'open-uri'
require 'json'
require 'nokogiri'
#require "win32/sapi5"
#include Win32
#$audio = SpVoice.new
#$audio.Rate=1
#$audio.Volume=100
@glurp
glurp / index.pug
Created September 28, 2018 13:40
Simple WhitestormJS app
div#app
@glurp
glurp / crrouter.cr
Last active April 21, 2018 19:52
router test : little http server for get local data (dir,file,proc) with Crystal lang and 'router' http server
require "router"
require "io/memory"
############################################################################
# Tools
############################################################################
def to_table(ll)
ll.map {|l|
"<tr><td>#{l.join("</td><td>")}</td></tr>"
@glurp
glurp / kemapp.cr
Last active April 19, 2018 01:24
kemal test : little http server for get local data (dir,file,proc) with Crystal lang
require "../src/kemal.cr"
require "io/memory"
############################################################################
# Tools
############################################################################
def to_table(ll)
ll.map {|l|
"<tr><td>#{l.join("</td><td>")}</td></tr>"
@glurp
glurp / smsrelay.js
Last active September 15, 2017 11:06
SMS relay : droidScript for relaying all sms received to a http GET, and send GET Response to SMS caller
///////////////////////////////////////////////////////////////////////////
/// SMSPROXY
// client sms ===> smsproxy ==> http://xxxx.org?from=number&msg=
// <--- response
// <=====reply
//
///////////////////////////////////////////////////////////////////////////
function OnStart()
{