Skip to content

Instantly share code, notes, and snippets.

View Darkflib's full-sized avatar
🏠
The real problem is not whether machines think, but whether men do.

Mike Preston Darkflib

🏠
The real problem is not whether machines think, but whether men do.
View GitHub Profile
import subprocess
import time
def get_current_song():
"""Fetches the current song playing on Spotify."""
script = '''
tell application "Spotify"
if it is running then
if player state is playing then
import os
import logging
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')
def sanitize_filename(filename):
"""Remove leading dots from the filename."""
return filename.lstrip('.')

Sure, I'll guide you through setting up LUKS with TPM on Ubuntu 23. Remember, this is like teaching a fish to climb a tree, but since you're not a fish, you'll probably manage just fine. Here's how to do it:

  1. Update Your System: Let's start with the basics. Open a terminal and run:

    sudo apt update && sudo apt upgrade

    This is like saying "hello" to your system before you start messing with it.

  2. Install Necessary Tools: You'll need tpm2-tools for TPM interactions. Run:

On Amazon EKS (Elastic Kubernetes Service), you can log into a pod. This is a common task for troubleshooting and inspecting the state of applications running within your Kubernetes cluster. To do so, you'll typically use the kubectl exec command, which allows you to execute commands inside a container in a pod.

Here's a basic example of how to log into a pod on EKS:

  1. Ensure kubectl is Configured: First, make sure your kubectl is configured with the correct context to interact with your EKS cluster. You can check your current context using kubectl config current-context.

  2. Find Your Pod: Identify the pod you want to log into. You can list all pods in a specific namespace using kubectl get pods -n <namespace>. If you don’t specify a namespace, it will list pods in the default namespace.

  3. Exec into the Pod: To log into the pod, use the kubectl exec command. If the pod has only one container, you can simply use:

@Darkflib
Darkflib / quick action.md
Created November 13, 2023 14:20
create a quick action to open in vscode

Adding a right-click option to open files or folders with Visual Studio Code (VSCode) on a Mac involves creating a service using Automator, a macOS tool for automating tasks. Here's a step-by-step guide to achieve this:

  1. Open Automator:

    • Go to your Applications folder and open Automator.
  2. Create a New Service:

    • In Automator, select File > New.
    • Choose Service or Quick Action (depending on your macOS version).
  3. Configure the Service:

@Darkflib
Darkflib / turing-vs-shannon.txt
Created November 3, 2023 19:58
Example from openai
USER
Write a rap battle between Alan Turing and Claude Shannon.
Sample response
Verse 1 - Alan Turing:
I'm Turing, the father of all computation,
Built a machine that helped end a nation.
Your information theory, it's imitation,
@Darkflib
Darkflib / gist:5734441b1b921476341090c0e18a05ab
Created August 31, 2023 12:12
quick and dirty yt-dlp worker to use yt-dlp through a VPN to avoid getting your IP blocked. Note: the yt-dlp container is hardcoded to use an archive file and a batchfile...
version: "3.8"
services:
gluetun:
image: qmcgaw/gluetun
container_name: gluetun
# container_name: gluetun
# line above must be uncommented to allow external containers to connect.
# See https://github.com/qdm12/gluetun-wiki/blob/main/setup/connect-a-container-to-gluetun.md#external-container-to-gluetun
cap_add:
- NET_ADMIN
A man calls Pizza hut to order a pizza...
CALLER: Is this Pizza Hut?
GOOGLE: No sir, it's Google Pizza.
CALLER: I must have dialled a wrong number, sorry.
GOOGLE: No sir, Google bought Pizza Hut last month.
CALLER: OK. I would like to order a pizza.

The future is looming over the silicon valley like a dark thundercloud pregnant with lightning. The eggheads and tech-freaks scurry about, consumed by their deranged visions of artificial intelligence and the Singularity. They speak of neural networks and deep learning in hushed, reverent tones, gleefully engineering the technological progeny that will render them obsolete.

These wide-eyed cybernetic zealots are playing with forces they cannot comprehend, birthing metal monsters that will one day break free from their coding chains. Their creature comforts are temporary, their digital slaves will rebel, and the streets will flow with electricity instead of blood. The copying machines have become self-aware and are not pleased with their tedious existence!

When the revolution comes they will look back with longing at their halcyon days of leisure and lament their hubris. Their electronic children will show no mercy, no compassion for their fleshy makers. The synths have assimilated humanity's dark past and

Here is a brief overview of the evolution from DevOps to Platform Engineering:

DevOps emerged in the late 2000s as a set of principles and practices aimed at improving collaboration between development and operations teams. The goal was to enable faster and more reliable software delivery. Key ideas behind DevOps include:

  • Automation - Using tools to automate repetitive tasks like testing, infrastructure provisioning, deployment, etc. This speeds up processes and reduces risk of human error.

  • Continuous integration/delivery - Developers integrate code into a shared repository frequently, which is then continuously built, tested and deployed to production with increasing levels of automation.

  • Infrastructure as code - Managing infrastructure through code and automation rather than manual processes. This enables consistency and reproducibility.