Skip to content

Instantly share code, notes, and snippets.

@b-coimbra
b-coimbra / google.rb
Created August 25, 2017 16:01
opens google and types something
#!/usr/bin/env ruby
# encoding: UTF-8
# USAGE: ruby google.rb <anything you want to search>
require 'win32ole'
shell = WIN32OLE.new("Wscript.Shell")
link = "www.google.com"
link =~ /www\.(.*)\.com/i
title = $1.capitalize
@b-coimbra
b-coimbra / p.apl
Created August 22, 2017 01:16
elementary propositional logic in APL
⍝ ex. 1
~((1 ∧ 0) ∨ (0 ↔ 1)) → ~(1 ∨ 0)
⍝ ~(0 ∨ 0) → ~(1 ∨ 0)
⍝ 1 → ~1
⍝ 1 → 0
⍝ 0
⍝ ex. 2
⍝ considering:
⍝ v(p) = 0
@b-coimbra
b-coimbra / spam.rb
Last active September 6, 2017 23:20
generates random text files
Thread.new{loop{open(rand(0..10e3).to_s+'.txt','w+'){|f|f<<rand(4000**2000).to_s(36)*10e2}}}.join rescue Errno::EACCESS abort 'Run as admin.'
# require gems, installs dependencies
def __import__(*lib)
lib.each do |i|
begin
require i
rescue LoadError
system "gem install #{i}"
Gem.clear_paths
retry
end
{
"shell_cmd" : "gcc $file_name -o ${file_base_name} && ${file_base_name}",
"working_dir" : "$file_path",
"variants":
[
{
"name": "Run",
"shell_cmd": "gcc $file_name -o ${file_base_name} && ${file_path}/${file_base_name}"
}
]
#include <stdio.h>
int main()
{
for (int i=0;++i<101;puts("")) {
char f[] = "FizzBuzz%d";
f[8-i%5&12]=0;
printf (f+(-i%3&4+f[8]/8), i);
}
}
define_method(:calc) { |c| return eval(c.gsub(/\[/,"(").gsub(/\]/,")").gsub(/(modulus|mod)/i,"%").gsub(/(subtract|minus)/i,"-").gsub(/(add|plus)/i,"+").gsub(/(\^|power by)/i,"**").gsub(/(×|∙|multiplied by)/i,"*").gsub(/(divided by|÷)/i,"/").gsub(/[^0-9\s\-\(\)^*+\/]/,"")) rescue return false }
@b-coimbra
b-coimbra / virus-fix.bat
Created July 24, 2017 19:05
flash drive malware cleaner
attrib -R -S -H /S /D
del *.lnk
rd /s /q RECYCLER
del /f autorun.inf
del /q /f /s 1j038que.exe
del /q /f /s 2ul.exe
del /q /f /s 9rfpp.exe
del /q /f /s fcphol.exe/csrcs.exe
del /q /f /s killVBS.vbs
del /q /f /s t2hjo0.exe
@b-coimbra
b-coimbra / locker.rb
Last active July 26, 2017 19:28
flash drive folder locker script
#/usr/bin/env ruby
# encoding: UTF-8
require 'io/console'
BEGIN {
FOLDER = "\u{00a0}"
PASSWORD = "12345"
$> << %{\e[35m
@b-coimbra
b-coimbra / template.css
Created July 9, 2017 17:11
model for flexible UI
@charset "UTF-8";
@import "https://fonts.googleapis.com/css?family=Roboto";
@import "https://fonts.googleapis.com/css?family=Raleway";
@import "https://fonts.googleapis.com/css?family=Open-Sans";
:root { --y-axis: 200px }
_:-ms-lang(x), @supports (not (--var: 0)) {
[class$='\66\78' i]:not(:empty):nth-child(-4+3n)::after, section { width: calc(var(--y-axis) * 100)) }