Skip to content

Instantly share code, notes, and snippets.

View pashri's full-sized avatar
🌍
Github has statuses?

Patrick Linton pashri

🌍
Github has statuses?
View GitHub Profile
@pashri
pashri / busy.sh
Created January 2, 2021 19:59
How to look busy
#!/bin/bash
cleanup () {
tput cnorm
exit 0
}
clear
trap cleanup EXIT TERM
tput civis
while true; do
@pashri
pashri / maybe.js
Created January 2, 2021 20:03
true, false, maybe?
Object.defineProperty(window, 'maybe', { get: function() { return Math.random() < 0.5; } });
@pashri
pashri / please.sh
Created January 2, 2021 20:04
Please?
alias please='sudo "$BASH" -c "$(history -p !!)"'
@pashri
pashri / Positivity.emoji
Created January 2, 2021 20:08
"Lots of negativity here, let me just plant this flower here to brighten things up"
☀️ ☁️ ☁️
🌈 ☁️
☁️
🌲🌳🌲 🌷 🌲🌳🌲
@pashri
pashri / please.sh
Created January 2, 2021 20:09
Please? (redux)
alias please='sudo $(fc -nl -1)'
@pashri
pashri / alphabet.md
Created January 2, 2021 20:11
The phonetic alphabet

A Aisle

B Bdellium

C Czar

D Djinn

E Eureka

@pashri
pashri / change_mac_address.sh
Created January 6, 2021 23:14
Change MAC address
sudo ifconfig en0 ether <MAC address>
@pashri
pashri / label_bar.py
Created January 6, 2021 23:20
Add value labels to the bars in a bar chart
import pandas as pd
import matplotlib as mpl
def label_bar(
s: pd.Series,
horizontal: bool = False,
**kwargs
) -> mpl.axes.Axes:
"""Creates a Matplotlib bar chart with values in the bars
from a Pandas Series."""
@pashri
pashri / encoding.md
Created January 7, 2021 23:16
UTF-8 And Latin-1 character encoding errors.

Sometimes you've got some incorrectly-encoded text that you want to fix. If you encode it to bytes and decode it back to a string, you can select the source and target encodings and fix the encoding in Python.

'Microsoft® Windows™ 10 is Patrick’s favourite OS'.encode('utf-8').decode('latin-1')
'Microsoft® Windowsâ\x84¢ 10 is Patrickâ\x80\x99s favourite OS'.encode('latin-1').decode('utf-8')
@pashri
pashri / index.html
Created January 23, 2021 23:29
The cubes
<div class="container">
<div id="cube">
<div class=""><div class="front">THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES</div></div>
<div class="a1"><div class="front">THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES</div></div>
<div class="a2"><div class="front">THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES</div></div>
<div class="a3"><div class="front">THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES</div></div>
<div class="a4"><div class="front">THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES</div></div>
<div class="a5"><div class="front">THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES</div></div>
<div class="a6"><div class="front">THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES<br/>THE CUBES</div></div>
<div class="a7"><div class="front">THE CUBES<br/>THE CUBES<br/>