Skip to content

Instantly share code, notes, and snippets.

@martijnvermaat
martijnvermaat / nixos.md
Last active May 9, 2024 01:11
Installation of NixOS with encrypted root
@muendelezaji
muendelezaji / bash-to-zsh-hist.py
Created October 5, 2016 14:18 — forked from op/bash-history-to-zsh-history.py
Convert Bash history to Zsh history
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is how I used it:
# $ cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history
import sys
import time
@jonilsonds9
jonilsonds9 / Instalar-zsh-e-componentes-ubuntu-22.04.md
Last active May 9, 2024 01:11
ZSH + Oh My Zsh + powerlevel10k + Fonts no Ubuntu 22.04

ZSH + Oh My Zsh + powerlevel10k + Fonts no Ubuntu 22.04

1. Instalar ZSH:

sudo apt-get install zsh

2. Instalar via curl, instale o mesmo se não tiver:

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@Jo0001
Jo0001 / 1.16 & older on 1.18+ servers.md
Last active May 9, 2024 01:07
1.16 & older on 1.18+ servers

1.16 & older on 1.18+ servers

[00:00:00 WARN]: [ViaBackwards] Custom worlds heights are NOT SUPPORTED for 1.16 players and older and may lead to errors! [00:00:00 WARN]: [ViaBackwards] You have min/max set to -64/384

Those messages sound familar to you?

Then you have 3 options:

  1. Only allow 1.17.x players
  2. Use 1.17 as server version (instead of 1.18)
  3. Use a datapack (thats why you're probably here)
@OrionReed
OrionReed / dom3d.js
Last active May 9, 2024 01:07
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@RyanNielson
RyanNielson / TrackTargets.cs
Created March 30, 2014 20:15
A orthographic camera script for Unity that keeps all targets in frame by adjusting orthographic size and camera position.
using UnityEngine;
public class TrackTargets : MonoBehaviour {
[SerializeField]
Transform[] targets;
[SerializeField]
float boundingBoxPadding = 2f;
@anddam
anddam / xsrf.interceptor.ts
Last active May 9, 2024 01:02
Angular HttpClientXsrfModule example
import { Injectable } from '@angular/core';
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpXsrfTokenExtractor } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable()
export class HttpXSRFInterceptor implements HttpInterceptor {
constructor(private tokenExtractor: HttpXsrfTokenExtractor) {
}
@mi-lee
mi-lee / unlike-delete-hide-facebook-posts.js
Last active May 9, 2024 01:00
Bulk delete, unlike, hide, or remove Facebook actions (in Activity Feed) by year.
// DISCLAIMER: I'VE ONLY RUN THIS SCRIPT ON MY OWN ACCOUNT ONLY. PROCEED/USE WITH RISK! I MADE THIS SCRIPT IN 20 MINUTES SO BE WARNED!
// On the other hand, I've deleted 50,000 comments in a matter of minutes so it's been pretty damn handy
// 1. Go to Activity feed, like facebook.com/<username>/allactivity
// 2. Navigate to specific section of FB, like "Likes and Reactions" or "Comments",
// like https://www.facebook.com/<username>/allactivity?privacy_source=activity_log&log_filter=cluster_<clusterid>
// 3. Navigate to year that you want to batch delete. You may need to scroll a little bit to let it load
// 4. Once you enter this there's no going back!!
@importRyan
importRyan / whenHovered.md
Last active May 9, 2024 00:57
Reliable SwiftUI mouse hover

Reliable mouseEnter/Exit for SwiftUI

Kapture 2021-03-01 at 14 43 39

On Mac, SwiftUI's .onHover closure is not always called on mouse exit, particularly with high cursor velocity. A grid of targets or with finer target shapes will often have multiple targets falsely active after the mouse has moved on.

It is easy to run back to AppKit's safety. Below is a SwiftUI-like modifier for reliable mouse-tracking. You can easily adapt it for other mouse tracking needs.

import SwiftUI