Skip to content

Instantly share code, notes, and snippets.

View Lathanao's full-sized avatar

Lathanao Lathanao

View GitHub Profile
@bitonic
bitonic / vectorized-atan2f.cpp
Last active April 16, 2024 12:17
Vectorized & branchless atan2f
// Copyright (c) 2021 Francesco Mazzoli <f@mazzo.li>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
@probonopd
probonopd / Wayland.md
Last active April 23, 2024 23:39
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.

Wayland proponents make it seem like Wayland is "the successor" of Xorg, when in fact it is not. It is merely an incompatible alternative, and not even one that has (nor wants to have) feature parity (missing features). And unlike X11 (the X Window System), Wayland protocol designers actively avoid the concept of "windows" (making up incompr

@lbrame
lbrame / archtweaks.md
Last active April 6, 2024 05:16
Tweaks I've made to my Arch Linux installation

Arch Linux tweaks

This is a collection of the tweaks and modification I've made to my Arch Linux installation over the months. These may be applicable to other distros, but please check first before doing anything. I also included Arch Wiki references for all the procedures I mentioned. My recommendation is not to blindly follow this gist but to always check with the Arch Linux wiki first. Things move fast and by the time you're reading this my gist may be out of date. Lastly, the golden rule: never execute a command you don't understand.

Installing the KDE Plasma desktop

My current DE of choice is KDE's Plasma. I find it just about perfect.

There are various ways to install it on Arch. The most popular one is to install plasma and plasma-applications, but I don't like doing that because it comes with too many programs I'll never use. I, instead, install the base plasma group, remove the few extra packages that come with it, then I finish off by installing a few KDE apps that don't come with th

@rizalp
rizalp / disable_spectre.md
Last active May 22, 2023 22:07
Disable Spectre/Meltdown Mitigation

In /etc/default/grub, modify:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off"

Then sudo update-grub

<?
// this script receives a Stripe dispute / chargeback and:
//
// - immediately refunds the payment
// - closes the user's account (in my DB, add your own code there)
//
// this is to automate dispute handling (because you never win a dispute on Stripe anyway)
// and by refunding avoiding the chargeback fee
//
@ElliotNB
ElliotNB / notify.sh
Last active December 5, 2023 02:35
Email sysadmin on every login from a new IP address
#!/bin/bash
##
## New IP login notification script
## 2009-11-20 00:28 Samuele ~redShadow~ Santi
## 2018-06-04 12:53 ElliotNB
## 2018-10-17 17:55 ElliotNB - bug fixes for non-interactive sessions and `sudo su` commands
## Licensed under GPL
##
## This script will email the contact specified below whenever
## a user logs into the system from a new IP address. The email will contain the
sudo su
apt-get install -y autoconf automake libtool nasm make pkg-config
cd /tmp
wget https://github.com/mozilla/mozjpeg/releases/download/v3.1/mozjpeg-3.1-release-source.tar.gz
tar -xvf mozjpeg-3.1-release-source.tar.gz
cd mozjpeg
autoreconf -fiv
mkdir build && cd build
sh ../configure
make install
@erikhansen
erikhansen / 1_product_queries.sql
Last active April 2, 2024 01:48
Magento 2 - Remove duplicate store view-specific product and category data
/*
* IMPORTANT: The queries below are written for Magento Enterprise. If you're going to run them on Magento Community, you need
* to replace all instances of ".row_id" with ".entity_id". See this for context: http://magento.stackexchange.com/questions/139740/magento-2-schema-changes-for-ee-catalog-staging
*
* When importing products in Magento 2, if you specify store view codes in the store_view_code column, product data will be set at
* both the global scope as well as the specific store view scope. This is not ideal because now you have duplicate
* data at two different scopes that shouldn't actually be duplicated. The scripts below clean up this data by finding
* data set at specific store view scopes and if it's an exact match to the data set at the global store view, then it
* deletes the data set at the specific store view scope.
*
@shinesoftware
shinesoftware / magento2-setup.sh
Last active November 9, 2020 08:41
Magento 2 - Bash Script - Install by cloning from Github repository and bash
#!/bin/bash
#title :magento2-setup.sh
#description :This script will install Magento from github
#author :Shine Software Italy
#date :20170202
#version :0.1
#usage :Set the execution permission for this file and then call it ./magento2-setup.sh
#notes :Install Composer and cURL to use this script.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?