Skip to content

Instantly share code, notes, and snippets.

View ajpen's full-sized avatar

Anfernee Jervis ajpen

View GitHub Profile
@ajpen
ajpen / studio_display_windows.md
Created August 19, 2023 18:51
How to fix a black screen on the studio display with a Thunderbolt 4 Nvidia dedicated graphics windows Laptop

If you have a Windows laptop with thunderbolt 4 and an Nvidia Dedicated Graphics card (I tested with a RTX 3050 ti), you might get a black screen when you plug in the Apple Studio Display into the thunderbolt 4 port of your laptop.
Assuming that your laptop's thunderbolt port graphics is handled by the Nvidia card, it might be that your Nvidia card is sending a DP1.4 signal over the thunderbolt 4 port, but still sending a native 5K resolution signal to the Studio Display. The studio display doesn't support native 5K over DP1.4, only 4K. You might have seen this online somewhere and tried to change the display resolution with windows settings, to no avail. The thing is, you need to do it from the Nvidia control panel.

Steps
  1. Plug in the studio display using the thunderbolt 3 cable it came with into the thunderbolt 4 port on your laptop
@ajpen
ajpen / host
Created April 10, 2023 19:54
socials blacklist without whatsapp
This file has been truncated, but you can view the full file.
# Title: StevenBlack/hosts with the social extension
#
# This hosts file is a merged collection of hosts from reputable sources,
# with a dash of crowd sourcing via GitHub
#
# Date: 07 April 2023 16:56:33 (UTC)
# Extensions added to this file: social
# Number of unique domains: 201,791
#
# Fetch the latest version of this file: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/social/hosts
@ajpen
ajpen / push_articles.sh
Created March 8, 2021 15:30
Script to curate and downloads articles to kindle.
#!/bin/bash
# Uncomment for debugging
set -xe
# Be sure to use absolute paths here
outputDir=PATH/TO/OUTPUT/DIR
sourcesDir=PATH/TO/RECIPES/DIR
today=$(date +%y-%m-%d)
@ajpen
ajpen / notes.md
Last active September 8, 2020 13:59
Random useful things I might forget later

.local Hostname Discovery (Raspberry PI Nano Ethernet over USB)

If running on nixos setup, use Network Manager to set this up.

  1. Configure raspberry pi boot and config parameters to enable network over USB.
  2. On network detection (with nmcli), edit the connection and change the configuration for IPv4 and IPv6 to Link-Local. This should properly setup and connect the Pi. If it doesn't try plug-out and in again or google it.
  3. If not already, edit configuration.nix and add the avahi service (check the client section here for instructions: https://nixos.wiki/wiki/Printing)

Extract/Partition Pages for PDFs

pdftk input.pdf cat 10-12 output output.pdf creates a new pdf output.pdf with pages 10, 11 & 12 from input.pdf.

@ajpen
ajpen / .vimrc
Last active August 22, 2020 15:46
vim stuff
"" Minimal setting and configuration
"" These settings makes editing less of a drag :)
"---------------------------------------------------------------------------------
"
"" Use vim settings
set nocompatible
" changes backspace indentation behavior
set backspace=indent,eol,start
"
@ajpen
ajpen / nixos-related.md
Last active August 17, 2020 14:36
NixOS cheatsheet
@ajpen
ajpen / cheatsheet.md
Created August 6, 2020 19:14
pandas cheatsheet

WHERE clause equivalent on dataframe

df[df['column_name'] == 'what to search for']

With AND and OR logical operators: df[df[('column_name'] == 'what to search for') & ('column_name'] == 'what to search for')]

df[df[('column_name'] == 'what to search for') | ('column_name'] == 'what to search for')]

LIKE clause equivalent

df[df['column_name'].str.contains('substring to look for')]

@ajpen
ajpen / clean_browser.txt
Created July 31, 2020 23:53
browser without addressbar, etc
For chrome/chromium it is the --app=http://address.com flag.
You would use it by calling chromium-browser --app=http://some.website.org or google-chrome --app=http://www.google.com or chrome.exe --app=http://you.get.it etc.
All available switches: http://peter.sh/experiments/chromium-command-line-switches/
EDIT: You might also want to take a look at the --kiosk flag.
For finding the nearest edge to a parking meter:
https://stackoverflow.com/questions/55522641/how-can-i-get-the-start-and-end-node-of-the-nearest-edge-to-large-points-faster
@ajpen
ajpen / configuration.nix
Last active July 24, 2020 04:23
Nixos setup for XPS machine
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix