Skip to content

Instantly share code, notes, and snippets.

View feynon's full-sized avatar

Ankesh Bharti feynon

View GitHub Profile
@ibireme
ibireme / kpc_demo.c
Last active July 16, 2024 10:53
A demo shows how to read Intel or Apple M1 CPU performance counter in macOS.
// =============================================================================
// XNU kperf/kpc demo
// Available for 64-bit Intel/Apple Silicon, macOS/iOS, with root privileges
//
//
// Demo 1 (profile a function in current thread):
// 1. Open directory '/usr/share/kpep/', find your CPU PMC database.
// M1 (Pro/Max/Ultra): /usr/share/kpep/a14.plist
// M2 (Pro/Max): /usr/share/kpep/a15.plist
// M3: /usr/share/kpep/as1.plist
@probonopd
probonopd / Wayland.md
Last active July 16, 2024 10:02
Think twice about Wayland. It breaks everything!

Think twice before abandoning Xorg. Wayland breaks everything!

Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating everyone else (e.g., people using just an X11 window manager or something like GNUstep) in the process.

The Wayland project seems to operate like they were starting a greenfield project, whereas at the same time they try to position Wayland as "the X11 successor", which would clearly require a lot of thought about not breaking, or at least providing a smooth upgrade path for, existing software.

In fact, it is merely an incompatible alternative, and not e

@swyxio
swyxio / cloudos.md
Last active May 3, 2023 12:23
Cloud Operating Systems and Reconstituting the Monolith. tweet responses: https://twitter.com/swyx/status/1226257539886669825?s=20
@feynon
feynon / episode.js
Created August 29, 2019 13:30 — forked from mpj/episode.js
Code from the "Dependency Injection Basics" episode of Fun Fun Function
const assert = require('assert')
function getAnimals(fetch, id) {
return fetch('http://api.animalfarmgame.com/animals/' + id)
.then(response => response.json())
.then(data => data.results[0])
}
describe('getAnimals', () => {
it('calls fetch with the correct url', () => {
document.addEventListener("DOMContentLoaded", function(event) {
var orderModule = (function() {
var orders = {},
EST_DELIVERY = "current estimated delivery time",
estimatedDeliveryTime;
PubSub.subscribe(EST_DELIVERY, function(msg, data) {
console.log(msg);
estimatedDeliveryTime = data;
});
@feynon
feynon / interfaceSegregation.js
Created August 24, 2019 20:03
A client should never be forced to implement an interface that it doesn’t use or clients shouldn’t be forced to depend on methods they do not use.
const manageShapeInterface = fn => ({
type: "manageShapeInterface",
calculate: () => fn()
});
const circle = radius => {
const proto = {
radius,
type: "Circle",
area: args => Math.PI * Math.pow(args.radius, 2)
import Events from 'eventemitter3';
const modelMixin = Object.assign({
attrs: {},
set (name, value) {
this.attrs[name] = value;
this.emit('change', {
prop: name,
value: value
@feynon
feynon / gpg_ssh.md
Created August 17, 2019 13:23
Exporting a private GPG key from primary machine to another and setting it up on another by importing it and building trust. Last commands include steps to add it to your local git settings.
  • Exporting Keys from machine holding the primary key
hermisaurus@pop-os:~$ gpg --list-secret-keys
/home/shermisaurus/.gnupg/pubring.kbx
-------------------------------------
sec   rsa2048 2019-08-17 [SC]
      91E3CA9C218F5DA0214E8D78D6A03EC9488BECA2
uid           [ultimate] Ankesh Bharti (https://keybase.io/shermisaurus) <ankeshbharti8@gmail.com>
ssb   rsa2048 2019-08-17 [E]
body footer nav::after {
content: " by Ankesh Bharti";
color: var(--accent-color);
font-size: 1em;
}
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&display=swap&subset=latin-ext');
:root {
--accent-color: #0000ff;
const roads = [
"Alice's House-Bob's House", "Alice's House-Cabin",
"Alice's House-Post Office", "Bob's House-Town Hall",
"Daria's House-Ernie's House", "Daria's House-Town Hall",
"Ernie's House-Grete's House", "Grete's House-Farm",
"Grete's House-Shop", "Marketplace-Farm",
"Marketplace-Post Office", "Marketplace-Shop",
"Marketplace-Town Hall", "Shop-Town Hall"
];