Skip to content

Instantly share code, notes, and snippets.

View johnie's full-sized avatar
httpster

Johnie Hjelm johnie

httpster
View GitHub Profile
export const showErrorToast = (message: string) => {
const toastTemplate = document.getElementById('toast-template') as HTMLTemplateElement;
if (!toastTemplate) return;
const toastClone = document.importNode(toastTemplate.content, true);
document.body.appendChild(toastClone);
const newToast = document.body.lastElementChild as HTMLElement;
if (!newToast) return;
use rand::Rng;
use std::cmp::Ordering;
use std::io;
fn main() {
println!("Guess the number!");
let secret_number = rand::thread_rng().gen_range(1..=100);
loop {
nums = [10, 80, 1, 30, 9]
max_value = None
for n in nums:
if n > max_value: max_value = n
@johnie
johnie / stream_to_youtube.sh
Created May 5, 2022 20:19 — forked from olasd/stream_to_youtube.sh
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
[
{
"category": "Action & Adventure",
"link": "https://www.netflix.com/browse/genre/1365"
},
{
"category": "Action Comedies",
"link": "https://www.netflix.com/browse/genre/43040"
},
{
@johnie
johnie / README.md
Last active January 25, 2024 16:23
Filter Phish – This Google Apps Scripts filter will automatically move all future emails with the header `X-PHISHTEST` to trash.

Filter Phish

This Google Apps Scripts filter will automatically move all future emails with the header X-PHISHTEST to trash.

Getting started

  1. Go to Google Apps Script
  2. Add a new script and copy paste the content from the sibling file
  3. Test run the script, go to View in the menu bar and click Logs
  • If there's no errors it should be blank, OR a verbose message that it removed a phishing email.
module.exports = () => 'Hello World';
@johnie
johnie / README.md
Last active May 29, 2018 09:02
Using npx to commit messages with JIRA Ticket

MRG Git

Using npx to commit messages with JIRA Ticket

Usage

$ npx https://gist.github.com/johnie/332d220c9fb753ee8d46cabd4bf34173 "This is a commit message"
//=> git commit -am "JIRA-455 This is a commit message"
@johnie
johnie / tfl.elrad.json
Created April 7, 2018 20:10
TFL Accessible stations
This file has been truncated, but you can view the full file.
{
"stations": [
{
"stationName": [
"Abbey Road"
],
"publicToilet": [
{
"$": {
"exists": "No"
@johnie
johnie / ComponentIndex.js
Created April 1, 2018 20:28 — forked from davidgljay/ComponentIndex.js
Pattern for dynamically loading React components based on a config json object.
import config from '../config'
let components = {}
//For each component in the config fiel into an object
for (var i = config.length - 1; i >= 0; i--) {
components[config[i].name] = require(config[i].path).default
}
export default components