Skip to content

Instantly share code, notes, and snippets.

View m0ngr31's full-sized avatar
👍

Joe Ipson m0ngr31

👍
View GitHub Profile
@eloylp
eloylp / Fedora35Hibernation.md
Last active March 25, 2024 15:47
Fedora 35 hibernation with swapfile, only for hibernation and resume

Fedora35 hibernation

This guide helps to configure the hibernation on a default Fedora35 (also worked fine in previous Fedora34) installation by using a swap file. The Fedora35 installation comes with btrfs as default filesystem. Also, it comes with a zram swap device:

$ swapon
NAME       TYPE      SIZE USED PRIO
/dev/zram0 partition   8G   0B  100
@awreese
awreese / useCancellableFetch.js
Last active October 5, 2022 23:35
Cancellable Fetch React Hook
import { useEffect } from "react";
/**
* Cancellable Fetch request decorator - Higher Order Function
* --
* Decorates a standard fetch request with an AbortController's signal
* included with the fetch options.
*
* Based, in part, upon Oleg Lytvyn's ["How you can abort Fetch() request on a flight…" article](https://itnext.io/how-you-can-abort-fetch-request-on-a-flight-830a639b9b92)
*
@fizzyade
fizzyade / nvidiaheadend.md
Last active February 27, 2024 22:43
tvheadend container + nvidia ffmpeg under Unraid

NVIDIA+TVHEADEND+UNRAID+ACCELERATED FFMPEG

I recently had a need to get hardware accelerated ffmpeg running on tvheaded under unraid, I eventually achieved this with a few tricks, here are my notes on what I did to achieve this.

First up, Unraid NVIDIA support

Install the Nvidia plugin under Unraid, this installs a custom kernel complete with the nidia drivers and docker runtime to support thiese.

Next install a hardware accelerated FFMPEG

@vlucas
vlucas / encryption.js
Last active April 2, 2024 14:26
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
import React, { Component } from 'react';
import { StyleSheet, Text, ScrollView, View, Dimensions } from 'react-native';
import AutoResponisve from 'autoresponsive-react-native';
const SCREEN_WIDTH = Dimensions.get('window').width;
/**
* we store all of our elements calculated heights in there
* @type {Array}
*/
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active April 15, 2024 02:19
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@application2000
application2000 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Last active February 21, 2024 03:02
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@kristopolous
kristopolous / hn_seach.js
Last active July 24, 2023 04:12
hn job query search
// Usage:
// Copy and paste all of this into a debug console window of the "Who is Hiring?" comment thread
// then use as follows:
//
// query(term | [term, term, ...], term | [term, term, ...], ...)
//
// When arguments are in an array then that means an "or" and when they are seperate that means "and"
//
// Term is of the format:
// ((-)text/RegExp) ( '-' means negation )
@belsrc
belsrc / gist:672b75d1f89a9a5c192c
Last active April 15, 2023 15:13
Simple Vue.js filters that I usually need
/**
* Changes value to past tense.
* Simple filter does not support irregular verbs such as eat-ate, fly-flew, etc.
* http://jsfiddle.net/bryan_k/0xczme2r/
*
* @param {String} value The value string.
*/
Vue.filter('past-tense', function(value) {
// Slightly follows http://www.oxforddictionaries.com/us/words/verb-tenses-adding-ed-and-ing
var vowels = ['a', 'e', 'i', 'o', 'u'];
@yumitsu
yumitsu / gist:ec0c8f1f03dbc94eed8c
Created August 29, 2014 09:22
ST3 build 3065, Linux x64 - licenses

These licenses will be valid after sublime_text patching:

- BEGIN License -
Love
Unlimited user license
EA7E-8441
918381ACA844A0379CCAC729059720A4
BC9D409098618744BB45FF23E67568DB
82B926D92157127DB3B4054834D0477F