Skip to content

Instantly share code, notes, and snippets.

View kinow's full-sized avatar
💭
😬

Bruno P. Kinoshita kinow

💭
😬
View GitHub Profile
#!/usr/bin/env bash
## Alias GAuth to copy current to clipboard
function gauth() {
[ ! -z "${1}" ] && {
/Users/$(whoami)/go/bin/gauth |grep -i "aws ${1}" |sed 's/AWS //' |awk '{print$3}' |pbcopy
echo -e "Copied $(pbpaste) clipboard!"
} || {
/Users/$(whoami)/go/bin/gauth
}
@Zazcallabah
Zazcallabah / data.json
Created November 29, 2016 08:45
Dashing dependency status
{
"info" : {
"buildId" : "20161128.7",
"buildDate" : "2016-11-28 14:01:33Z",
"commitHash" : "5a0bf8b4c25b897f0dee3c7e315422e96a182472",
"deployDate" : "2016-11-28 14:03:44Z",
"error" : null
},
"dependencies" : [{
"name" : "Api1",
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active April 27, 2025 10:04
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@azizasm
azizasm / forticlientsslvpn-expect.sh
Last active September 21, 2022 21:10
Continuous run Forticlient VPN using expect. Automatically restart VPN if get disconnected or session closed.
#!/bin/bash
# Forticlient SSL VPN Client / expect
# --------------------------------------------
# CONFIGURATION
FORTICLIENT_PATH=""
@nportinari
nportinari / verba_ministerio_saude.ipynb
Last active March 12, 2020 17:40
Verba - Ministério da Saúde
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ssledz
ssledz / asus-bt400-linux-install.md
Last active December 25, 2024 23:48
Linux Installation guide for Asus USB-BT400

Download driver

curl 'https://dlcdnets.asus.com/pub/ASUS/wireless/USB-BT400/DR_USB_BT400_1201710_Windows.zip' \
  -o bt400-driver.zip

Driver & tools for bt400 can be found here

Find out what is a filename for your driver

Plug device and do

Why do I need 106mb of JS for an empty rails app?

$ cd /tmp
$ rails -v 
Rails 6.0.3.2
$ rails new my-app 
Using -T -d postgresql from /Users/rileytg/.railsrc # use postgres, dont use tests (usually add rspec). this is a fairly common rails stack.
...
Bundle complete! 14 Gemfile dependencies, 65 gems now installed.
...

Comments on optimizations around string concatenation.

Note: The code links are to CPython 3.8.5, the most recent release when this was written.

I was recently asked about a performance optimization in CPython around using += and + for string objects. As some people may already know, if you use += or + a string, it can sometimes be just as fast as ''.join. The question was to explain when that optimization couldn't be performed.

We will be going through the following example scenarios:

TL/DR Not every type hole is harmful.

[Disclaimer: The following code is typed with scriptum, a type validator for dynamically typed Javascript. It has its roots in Haskell's Hindley-Milner based type system.]

It helps to consider mutations to get a better intuition. Mutations are a side effect and thus harmful. However, if we manage to hedge side effects so that we don't lose track of them, then we can benefit from the flexibility they provide without having to suffer the consequences.

For mutations this merely essentially means ensuring they stay local. Local mutations are fine in most cases. The same applies to type holes.

Let's work through some code to see if this claim holds. Gradual typing is a trade-off. Good coding means to find the most promising trade-offs.

@sadielbartholomew
sadielbartholomew / generate_spreadsheet_pixel_art.py
Created August 5, 2021 19:28
Generate spreadsheet (Excel) pixel art from an arbitrary image
"""Gist to generate spreadsheet (Excel) pixel art from an arbitrary image.
Gist by Sadie Louise Bartholomew ('sadielbartholomew'), 05.08.21.
Q) Why would I want to do this?
A) Exactly. Programming gives us too much power to do silly and pointless
things.
Requires certain libraries to work: see the `import` list.