Skip to content

Instantly share code, notes, and snippets.

@Killeroid
Killeroid / gpg-import-and-export-instructions.md
Created October 18, 2017 11:51
How to export and import gpg keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Gotten from the RedHat GPG migration manual

Backup the public and secret keyrings and trust database

## Export all public keys

gpg -a --export >mypubkeys.asc

@islander
islander / fsck_qcow2.md
Last active April 30, 2024 15:00
Recover a qcow2 image using fsck

Recover a qcow2 image using fsck

Load network block device module:

# modprobe nbd max_part=8

Poweroff machine:

# virsh destroy virtual-machine

@v-fox
v-fox / NVMe_tweaks.md
Last active April 30, 2024 14:59
Linux kernel optimizations for NVMe

By default Linux distros are unoptimized in terms of I/O latency. So, here are some tips to improve that.

The performance can be checked by:

  • fio --name=read --readonly --rw={read/randread} --ioengine=libaio --iodepth={jobs_per_each_worker's_command} --bs={4k/2M} --direct={0/1} --numjobs=<number_of_parallel_workers> --runtime={10/30/60} --group_reporting --filename=/dev/nvme<device> - to simulate an optimized app;
  • dd_rescue /dev/nvme<device> /dev/null -b {4k/2M} {-d} - to simulate a stupid app.

Appropriate settings are changed in appropriate places, such as:

  • /etc/tuned/<custom-profile>/tuned.conf:
@bryanltobing
bryanltobing / zod-file-validation.tsx
Last active April 30, 2024 14:57
Zod schema to validate input type file
import { z } from "zod"
const schema = z.object({
file:
typeof window === "undefined" // this is required if your app rendered in server side, otherwise just remove the ternary condition
? z.undefined()
: z
.instanceof(FileList)
.refine(file => file.length !== 0, {
message: "File is required",
@silgon
silgon / 2d_curve_fit.py
Last active April 30, 2024 14:56
Python curve_fit function with 2d data
# curvefit with non linear least squares (curve_fit function)
import numpy as np
from scipy.optimize import curve_fit
def func(x, a, b, c):
return a*np.sin(x[0])+b*np.cos(x[1])+c
limits = [0, 2*np.pi, 0, 2*np.pi] # [x1_min, x1_max, x2_min, x2_max]
side_x = np.linspace(limits[0], limits[1], 100)
side_y = np.linspace(limits[2], limits[3], 100)
@berkorbay
berkorbay / github_desktop_ubuntu.md
Last active April 30, 2024 14:54
To install Github Desktop for Ubuntu

IMPORTANT

See the following links for further updates to Github Desktop for Ubuntu. These are official instructions. (also mentioned by fetwar on Nov 3, 2023)

For the sake of "maintaining the tradition" here is the updated version.

@SuperFlue
SuperFlue / AudioAffinity.xml
Created August 9, 2023 20:38
Scheduled task template for automatically setting core affinity on the audiodg service
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2021-03-13T14:05:56.3414408</Date>
<Author>SuperFlue</Author>
<URI>\AudioAffinity</URI>
</RegistrationInfo>
<Triggers>
<LogonTrigger>
<Enabled>true</Enabled>
@derekstavis
derekstavis / FastList.tsx
Last active April 30, 2024 14:50 — forked from vishnevskiy/FastList.js
Discord's FastList, but in TypeScript
import { forEachObjIndexed } from "ramda";
import * as React from "react";
import {
Animated,
ScrollView,
View,
ViewStyle,
LayoutChangeEvent,
NativeScrollEvent,
} from "react-native";
@PurpleVibe32
PurpleVibe32 / vmwk17key.txt
Last active April 30, 2024 14:49
Free VMware Workstation Pro 17 full license keys
Install VMWare Workstation PRO 17 (Read it right. PRO!)
Also, these keys might also work with VMWare Fusion 13 PRO. Just tested it.
Sub to me on youtube pls - PurpleVibe32
if you want more keys - call my bot on telegram. @purector_bot (THE BOT WONT REPLY ANYMORE) - Or: https://cdn.discordapp.com/attachments/1040615179894935645/1074016373228978277/keys.zip - the password in the zip is 102me.
---
This gist can get off at any time.
PLEASE, DONT COPY THIS. IF YOU FORK IT, DONT EDIT IT.
*If you have a problem comment and people will try to help you!
*No virus
@TrevTV
TrevTV / ArcOn10.md
Last active April 30, 2024 14:48
Guide to installing Arc Browser on Windows 10

As this is not an official way of installing Arc, if you encounter any issues do NOT report them to the developers, they did not intend for people to be running Arc on Windows 10.

This guide is a bit more manual since I wanted to respect the developers' wishes and not directly link any downloads to the beta of Arc.

I don't know how this will work with updates, you may just need to redo the process to update it, but I'm not sure

  1. Install this font: https://aka.ms/SegoeFluentIcons (this fixes the icons since Windows 10 doesn't have this font installed by default)
  2. Download the Arc appinstaller and open it in notepad/some other text editor
  3. Copy everything inside and paste it into this website: https://codebeautify.org/xmlviewer (this is optional, but it makes reading and copying from the file easier)
  4. Find the mainpackage @Uri, it should end in Arc.x64.msix, and open that in a new tab. It should download that msix file.