Skip to content

Instantly share code, notes, and snippets.

@b-coimbra
b-coimbra / dimensions.rb
Last active January 23, 2018 02:03
Script to rename .png files with their respective dimensions
#!/usr/bin/env ruby
# encoding: UTF-8
Dir['*'].each { |f|
File.rename(f, ((File.binread(f.to_s)[0x10..0x18].unpack('NN')*?x + ' ' + f) if File.extname(f)[/\.png/])) if f != $0
} rescue Errno::ENOENT abort '[!] Run as admin.'

A Complete CS Education Reading List

How Computers Work - A Casual Intro

  1. The Pattern on the Stone - Hills
  2. Code - Petzold

Actual Programming

  1. Haskell Programming From First Principles
  1. Parallel and Concurrent Programming in Haskell
@b-coimbra
b-coimbra / lam.rb
Created January 2, 2018 17:52
lambda clusterfuck
define_method :λ, -> *args, &block { block::(args) }
λ{λ{λ{λ{λ{λ{λ{λ{λ(λ{λ{λ{5}}},λ{λ{2}},λ{λ{4}},λ{λ{5}}){|i|p i}}}}}}}}} # 3 2 4 5
@b-coimbra
b-coimbra / cyb
Created January 1, 2018 14:45
cyberpunk learning resources
**LEARNING**
http://cybrary.it/
http://n0where.net/
http://www.offensive-security.com/metasploit-unleashed
http://resources.infosecinstitute.com/
http://www.windowsecurity.com/articles-tutorials/
http://www.sans.org/reading-room/
https://www.corelan.be/index.php/articles/
http://opensecuritytraining.info/Training.html
@b-coimbra
b-coimbra / edit.js
Created December 18, 2017 14:16
makes page editable
javascript:document.body.contentEditable='true'; document.designMode='on'; void 0
function fun(){if(aZ=["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"],document.getElementById("animator")){var t=document.getElementById("animator");t.parentNode.removeChild(t)}f=document.createElement("style"),f.setAttribute("id","animator");for(var e=0;e<aZ.length-1;e++)h=Math.floor(Math.random()*(window.screen.width/Math.floor(8*Math.random())-1)),k=Math.floor(Math.random()*(window.screen.height/Math.floor(8*Math.random())-1)),g="@keyframes ${from{left:"+a[0]+"px; top:"+a[1]+"px}to{left:"+h+"px; top:"+k+"px}} @-webkit-keyframes ${from{left:"+a[0]+"px; top:"+a[1]+"px}to{left:"+h+"px; top:"+k+"px}}",a[0]=h,a[1]=k,f.innerHTML+=g.replace(/[\$]/g,aZ[e]);document.head.appendChild(f);for(var n=0;n<document.getElementsByTagName("*").length-1;n++){var o=document.getElementsByTagName("*")[n];-1==v.indexOf(o.tagName)&&(o.style.webkitAnimationName=aZ[Math.floor(Math.random()*(aZ.length-1))],o.style.webkitAnimationDuration=Math.floor(8*Math.random())+"s",o.style.
@b-coimbra
b-coimbra / yt.rb
Last active December 16, 2017 21:55
mpv script - youtube search on the terminal
#!/usr/bin/env ruby
require 'eat'
abort "Usage: yt.rb <search> <max>" if ARGV[0].nil?
class String
{ :reset => 0,
:bold => 1,
:dark => 2,
Dir['*'].each { |f| File.rename(f, f.gsub(/\-|\_/m, ' ')) if f != $0 } rescue Errno::ENOENT abort 'INVALID DIRECTORY'
@b-coimbra
b-coimbra / pyrb.rb
Created September 10, 2017 20:44
python methods inside ruby
# TODO: lambda expressions
class String
define_method(:format) { |*args| self.tr('{}', '%s') % args }
end
module Kernel
alias_method :__init__, :initialize
alias_method :import, :require
end
@b-coimbra
b-coimbra / vivaldi.css
Last active December 7, 2017 17:25
vivaldi custom CSS
/* focus debugging
#browser *:focus {
background-color:rgba(200,0,0,.2) !important;
outline: 2px solid rgba(200,0,0,.5) !important;
visibility: visible !important;
display: initial !important;
transform: scale(1), translate3D(0,0,0) !important;
}
*/