Skip to content

Instantly share code, notes, and snippets.

@tiran
tiran / python-on-debian.md
Last active May 21, 2024 08:46
Negative Python user experience on Debian/Ubuntu

Negative Python user experience on Debian/Ubuntu

The user experience of Python on a minimal Debian or Ubuntu installation is bad. Core features like virtual environments, pip bootstrapping, and the ssl module are either missing or do not work like designed and documented. Some Python core developers including me are worried and consider Debian/Ubuntu's packaging harmful for Python's reputation and branding. Users don't get what they expect.

Reproducer

The problems can be easily reproduced with official Debian and Ubuntu containers in Docker or Podman. Debian Stable (Debian 10 Buster) comes with Python 3.7.3. Ubuntu Focal (20.04 LTS) has Python 3.8.5.

Run Debian container

@KernelA
KernelA / .dockerignore
Created February 1, 2020 20:31
.dockerignore example for Python projects
# Git
.git
.gitignore
.gitattributes
# CI
.codeclimate.yml
.travis.yml
.taskcluster.yml
@alanbacelar
alanbacelar / auto_select_certificate.json
Created March 27, 2023 13:53 — forked from njh/auto_select_certificate.json
Policy file to configure Chrome/Chromium to automatically select a client certificate (useful for Kiosk mode)
{
"AutoSelectCertificateForUrls": ["{\"pattern\":\"*\",\"filter\":{}}"]
}
@karlhorky
karlhorky / migrate-to-eslint-plugin-import-x.diff
Last active May 21, 2024 08:44
Migrate from eslint-plugin-import to eslint-plugin-import-x
// Migrate from eslint-plugin-import (no ESLint v9 support, multiple issues and missing features)
// to eslint-plugin-import-x
//
// - https://www.npmjs.com/package/eslint-plugin-import
// - https://www.npmjs.com/package/eslint-plugin-import-x
// First, install `eslint-plugin-import-x` (and for TypeScript support, `@typescript-eslint/parser`)
-import eslintImport from 'eslint-plugin-import';
+import eslintImportX from 'eslint-plugin-import-x';
@shoaloak
shoaloak / fix-entitlements.sh
Last active May 21, 2024 08:43
This script automates the process of granting specific entitlements to a set of iOS binaries, resolving issues related to 'Operation not permitted' errors, e.g., when accessing /private/var/mobile/Containers.
#!/bin/bash
# Author: Shoaloak (Axel Koolhaas) 2024
# Description: Fix iOS binary entitlements/access for "Operation not permitted"
ENTITLEMENT="com.apple.private.security.container-manager"
binaries=("sh" "bash" "zsh" "dash" # Shell
"ls" "cat" "find" "cp" "mv" # File management
"rm" "mkdir" "rmdir" "touch"
"file" "ln" "du" "scp"
"chmod" "chown" "chgrp" # Permissions
@steos
steos / client.conf
Created November 9, 2011 18:26
openvpn config with lan gaming support
client
# specify server ip address here
remote <SERVER-IP>
dev tap
# name of the windows network connection
dev-node openVPN
@flyingwebie
flyingwebie / WSForm_fws_pull_metabox_data.php
Last active May 21, 2024 08:41
WSForm: Pull data from MetaBox Settings data and populate Select or Checkbox
<?php
// Creation Websites
// Add filter to change form '2' for Web Design prior to rendering
add_filter("wsf_pre_render_2", "fws_create_websites", 10, 1); // <=== CHANGE THE FUNCTION NAME
function fws_create_websites($form) {
// Get MetaBox Custom Fields - Setting Page -- Master Pricing
$setting_page = "master-pricing";
$field_name = "creation_services"; // <=== CHANGE ME WITH THE RIGHT CUSTOM FIELD ID (METABOX)
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();

Interview Questions

Node.js

Q1: What do you mean by Asynchronous API? ☆☆

Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Source: tutorialspoint.com

@superseb
superseb / restore-rkestate-file.md
Last active May 21, 2024 08:31
Recover cluster.rkestate file from controlplane node

Recover cluster.rkestate file from controlplane node

RKE

Run on controlplane node, uses any found hyperkube image

k8s 1.19 and higher

docker run --rm --net=host -v $(docker inspect kubelet --format '{{ range .Mounts }}{{ if eq .Destination "/etc/kubernetes" }}{{ .Source }}{{ end }}{{ end }}')/ssl:/etc/kubernetes/ssl:ro --entrypoint bash $(docker inspect $(docker images -q --filter=label=org.opencontainers.image.source=https://github.com/rancher/hyperkube.git) --format='{{index .RepoTags 0}}' | tail -1) -c 'kubectl --kubeconfig /etc/kubernetes/ssl/kubecfg-kube-node.yaml -n kube-system get configmap full-cluster-state -o json | jq -r .data.\"full-cluster-state\" | jq -r .' > cluster.rkestate