Skip to content

Instantly share code, notes, and snippets.

View johnie's full-sized avatar
httpster

Johnie Hjelm johnie

httpster
View GitHub Profile
@johnie
johnie / README.md
Created August 13, 2024 17:19
Automatically create a PNG copy of WEBP image

WEBP to PNG Converter

This Automator workflow automatically creates PNG copies of WEBP images in your Downloads and Pictures folders.

Features

  • Watches Downloads and Pictures folders for WEBP files
  • Automatically creates a PNG copy of each WEBP file
  • Keeps the original WEBP file intact
  • Uses built-in macOS sips command for conversion
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"