Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
v=$1
o=$2
d=$4
loaders=('grub')
test -r /etc/default/installkernel &&
source /etc/default/installkernel
@felipec
felipec / aur-check
Last active May 5, 2021 08:08
Script to check AUR packages
#!/usr/bin/env ruby
# This script checks all your foreign packages against AUR to find newer versions
require 'net/http'
require 'json'
$packages = {}
$all = false
#!/usr/bin/env ruby
$sucrose_points = 386.5
$extract_potential = {
'2 row' => 0.79,
'crystal 10L' => 0.75,
'carapils' => 0.72,
}
@felipec
felipec / ingresos
Created August 24, 2015 19:05
Script para general ingresos correjidos del INEGI
#!/usr/bin/env ruby
$hogares = {}
open('concentradohogar.csv').each_with_index do |l,i|
next if i == 0
data = l.split(',')
viv, hog = data[0..1]
integ = data[13].tr('"', '').to_i
$hogares[[viv, hog]] = [integ, 0]
@felipec
felipec / enigma
Last active August 29, 2015 14:16
Enigma machine in Ruby
#!/usr/bin/env ruby
CHARS = ('A'..'Z')
=begin
def stringify(array)
array.map(&:join).join(' ')
end
@felipec
felipec / steam.txt
Created June 3, 2014 10:34
Steam system information
Processor Information:
Vendor: GenuineIntel
CPU Family: 0x6
CPU Model: 0x3a
CPU Stepping: 0x9
CPU Type: 0x0
Speed: 2401 Mhz
4 logical processors
2 physical processors
HyperThreading: Supported
@felipec
felipec / git-marks-check
Last active September 8, 2016 02:32
Tool to check and fix git-remote-hg marks
#!/usr/bin/env ruby
require 'json'
$fix = false
$verbose = false
$git_marks = {}
$r_marks = {}
$note_marks = {}
$mode = 'hg'
@felipec
felipec / autogroups
Last active November 22, 2020 04:02
Display a list of all the processes listed by their autogroup (CONFIG_SCHED_AUTOGROUP)
#!/usr/bin/env ruby
$autogroups = Hash.new { |h,k| h[k] = [] }
Dir.glob('/proc/*').each do |e|
pid = File.basename(e).to_i
next if pid == 0
begin
cmdline = File.read(e + '/cmdline').split("\0").join(" ")
next if cmdline.empty?
@felipec
felipec / parseopt.rb
Last active May 26, 2021 20:29
Simple option parser
# This is now a gem
# https://rubygems.org/gems/parseopt
class ParseOpt
class Option
attr_reader :short, :long, :help
def initialize(short, long, help, &block)
@block = block
@short = short
@felipec
felipec / asus_fan.c
Created August 6, 2013 21:51
ASUS fan control
/*
*
* obj-m := fan.o
* KDIR := /lib/modules/$(shell uname -r)/build
* PWD := $(shell pwd)
*
* all:
* $(MAKE) -C $(KDIR) M=$(PWD) modules
*
* clean: