Skip to content

Instantly share code, notes, and snippets.

View ferbass's full-sized avatar
:octocat:
ι(`ロ´)ノ

Fernando Bass ferbass

:octocat:
ι(`ロ´)ノ
View GitHub Profile
@ferbass
ferbass / individual_key.rb
Created March 21, 2025 06:34
Generate and Test AppStoreConnect API Key
require 'jwt'
require 'net/http'
require 'uri'
require 'json'
KEY_ID = ""
PRIVATE_KEY_PATH = ".p8"
API_URL = "https://api.appstoreconnect.apple.com/v1/apps"
private_key = OpenSSL::PKey::EC.new(File.read(PRIVATE_KEY_PATH))
@ferbass
ferbass / ttpoe.lua
Last active November 22, 2024 02:48
[WIP]TTPoE wireshark dissector
-- Tesla Transport Protocol (TTPoE) Wireshark Dissector
-- Based on Tesla's Implementation
-- https://github.com/teslamotors/ttpoe
-- Dissector author: github.com/@ferbass
local ttpoe = Proto("ttpoe", "Tesla Transport Protocol over Ethernet")
-- Extension Types
local TTP_EXTENSION_TYPES = {
[0x00] = "TTP_ET__BASE/PROTOCOL/DATA_VC/REQUEST_VC",
@ferbass
ferbass / check-for-updates.sh
Last active August 16, 2023 02:52
Check for Linux host (Debian) available updates and post to slack
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi
# Check for upgradable packages
@ferbass
ferbass / check-for-reboot.sh
Created August 14, 2023 01:49
Post to slack if your host requires reboot
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi
# Function to send a message to Slack
@ferbass
ferbass / shutdown-cause.md
Last active December 7, 2022 04:46
macOS Shutdown Cause

Finding shutdown cause

log show --predicate 'eventMessage contains "Previous shutdown cause"' --last 24h

Software Codes

1            Power adapter disconnected
3            Dirty Shutdown/Sleep resulting from forced restart or shutdown
5 Clean Shutdown/Sleep initiated by the user
@ferbass
ferbass / proc-mem-info-awk.sh
Last active October 26, 2022 02:53
Convert /proc/meminfo to KB, MB and GB as appropriate
# convert any kB lines to MB:
awk '$3=="kB"{$2=$2/1024;$3="MB"} 1' /proc/meminfo
# converts to gigabytes:
awk '$3=="kB"{$2=$2/1024^2;$3="GB";} 1' /proc/meminfo
# convert to MB or GB as appropriate:
awk '$3=="kB"{if ($2>1024^2){$2=$2/1024^2;$3="GB";} else if ($2>1024){$2=$2/1024;$3="MB";}} 1' /proc/meminfo
@ferbass
ferbass / enable_snap.sh
Created September 3, 2022 01:44
WSL2 Ubuntu enable snap
sudo apt-get update && sudo apt-get install -yqq daemonize dbus-user-session fontconfig
sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME
snap version
class Solution {
public:
vector<vector<string>> partition(string s) {
vector<vector<string>> result;
vector<string> part;
dfs(0, s, part, result);
return result;
}
void dfs(int i, string& s, vector<string>& part, vector<vector<string>>& result){
if(i>=s.size()){
@ferbass
ferbass / instructions.md
Last active December 29, 2022 03:22
Linkedin unfollow all
@ferbass
ferbass / solution.py
Created May 5, 2020 06:07
1.3 Hidden Messages in the Replication Origin (Part 2)
# Copy your updated FrequentWords function (along with all required subroutines) below this line
def FrequentWords(Text, k):
FrequentPatterns = [] # output variable
# your code here
Count = CountDict(Text, k)
m = max(Count.values())
for i in Count:
if Count[i] == m:
FrequentPatterns.append(Text[i:i+k])