Skip to content

Instantly share code, notes, and snippets.

@nofxx
nofxx / morse.rb
Last active May 10, 2021 11:31
Morse Code in ruby
class String
MORSE_CODE = {
a: '.-', b: '-...', c: '-.-.', d: '-..', e: '.', f: '..-.',
g: '--.', h: '....', i: '..', j: '.---', k: '-.-', l: '.-..',
m: '--', n: '-.', o: '---', p: '.--.', q: '--.-', r: '.-.', s: '...',
t: '-', u: '..-', v: '...-', w: '.--', x: '-..-', y: '-.--', z: '--..'
}
def to_morse_code
self.downcase.each_char.map { |c| MORSE_CODE[c.to_sym] }.join
@nofxx
nofxx / files.py
Last active November 13, 2016 22:35
GNOME Terminator clickable paths open in Emacs
# Clickable Files by nofxx
"""files.py - Clickable Files URIs open in Emacs"""
import re
import terminatorlib.plugin as plugin
import subprocess
# Every plugin you want Terminator to load *must* be listed in 'AVAILABLE'
AVAILABLE = ['FileURLHandler']
class FileURLHandler(plugin.URLHandler):
@nofxx
nofxx / Rakefile
Created November 13, 2014 03:20
C++/Cpp Rakefile with includes, links... OpenCV example
#
# CPP Rakefile
#
EXEC = "square" # Your app executable
FLAGS = "-Wall -Wextra" # Flags for building
EXTRA = %w{ OpenCV } # Extra includes
#
# Nothing to see here, move along...
#
@nofxx
nofxx / ffemacs
Last active December 25, 2015 13:59
firefox + better errors + emacs => click to fix error!
#!/usr/bin/env ruby
chunk = ARGV.join
head, line = chunk.split("&line=")
trash, file = head.split("file://")
file = file.gsub!("%2F", "/")
args = `ps aux | grep emac[s]` == "" ? "c" : ""
@nofxx
nofxx / logstash.conf
Last active December 24, 2015 13:49
Centralized Ruby/Rails/MongoDB/Redis/Sidekiq/Elasticsearch/Haproxy/PG/OS -> syslog-ng -> logstash -> elasticsearch -> kibana =D
#
# Logstash conf!
#
input {
tcp {
host => "0.0.0.0"
port => 514
type => syslog
}
udp {
@nofxx
nofxx / bootstrap.tabfix.coffee
Last active December 24, 2015 04:39
Fix bootstrap tabs! Go back in F5/reload/etc
#
# Fix bootstrap tabs! Go back in F5/reload/etc
#
doc.on 'created', '.tab-fix', ->
hash = document.location.hash;
if (hash)
$(@).find("a[href='#{hash}']").tab('show')
for link in $(@).find('a')
do (link) ->
@nofxx
nofxx / .conkyrc
Created December 11, 2012 05:49
Conky for intel X79/it87
#
# xConky settings
#
update_interval 2
total_run_times 0
net_avg_samples 1
cpu_avg_samples 2
imlib_cache_size 0
@nofxx
nofxx / resque.rake
Created February 9, 2012 10:25
Resque syslog (via log4r)
require 'log4r'
require 'log4r/outputter/syslogoutputter'
require 'resque/failure/multiple'
require 'resque/failure/redis'
module Resque
module Failure
class Syslog < Base
# Define your logger, change as needed.
@nofxx
nofxx / barcode.rgin
Created November 1, 2011 17:00
RGhost Tests
(type.ps) runlibfile
(unit.ps) runlibfile
(IsoLatin.enc) runlibfile
/default_encoding IsoLatin def
<< /Duplex false /Tumble false >> setpagedevice
/pagesize [595 842] def
/margin 3 dict def margin begin /top 1 cm def /right 1 cm def /bottom 1 cm def /left 1 cm def end
(paper.ps) runlibfile
[ /Producer (Ruby Ghostscript - RGhost v0.8.7) /DOCINFO pdfmark /rows_per_page 80 def /count_pages 10 def /row_height 0.4 cm def /row_padding 0.1 cm def (basic.ps) runlibfile
(cursor.ps) runlibfile
@nofxx
nofxx / c
Created October 19, 2011 04:42
rc1
main()
int x = 1;
float y = 22.5;
char c = 'C';
char[] = "Take this " + c + "!";
printf("x to i: %d\n", x);