Skip to content

Instantly share code, notes, and snippets.

View PeskyPotato's full-sized avatar
🥔

PeskyPotato PeskyPotato

🥔
View GitHub Profile
@PeskyPotato
PeskyPotato / merwedelingelijn-timetable.csv
Last active March 24, 2024 11:19
Create rail timetable graphs in R using ggplot2
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 35 columns, instead of 24. in line 3.
Stations,Distance,7112,7114,7116,7117,7118,7119,7120,7121,7122,7123,7124,7125,7127,7129,7131,7133,7214,7216,7217,7218,7219,7220,7221,7222,7223,7224,7225,7226,7227,7228,7229,7231,7233
Dordrecht,0,06:54:00,07:24:00,07:54:00,06:01:00,08:24:00,06:31:00,08:54:00,07:01:00,09:24:00,07:31:00,09:54:00,08:01:00,08:31:00,09:01:00,09:31:00,10:01:00,07:09:00,07:39:00,05:46:00,08:09:00,06:16:00,08:39:00,06:46:00,09:09:00,07:16:00,09:39:00,07:46:00,10:09:00,08:16:00,10:39:00,08:46:00,09:16:00,09:46:00
Dordrecht,0,06:54:00,07:24:00,07:54:00,06:01:00,08:24:00,06:31:00,08:54:00,07:01:00,09:24:00,07:31:00,09:54:00,08:01:00,08:31:00,09:01:00,09:31:00,10:01:00,07:09:00,07:39:00,05:46:00,08:09:00,06:16:00,08:39:00,06:46:00,09:09:00,07:16:00,09:39:00,07:46:00,10:09:00,08:16:00,10:39:00,08:46:00,09:16:00,09:46:00
Dordrecht - Stadspolders,3.4,06:50:00,07:20:00,07:50:00,06:04:00,08:20:00,06:34:00,08:50:00,07:04:00,09:20:00,07:34:00,09:50:00,08:04:00,08:34:00,09:04:00,09:34:00,10:04:00,07:05:00,07:35:00,05:49:00,08:05:00,06:19:00,08:35
@PeskyPotato
PeskyPotato / dht11_esp32_wot.ino
Created June 2, 2020 14:53
Setup ESP32 as Web of Things device to record temperature and humidity using the DHT11
#define LARGE_JSON_BUFFERS 1
#define ARDUINOJSON_USE_LONG_LONG 1
#include <Arduino.h>
#include "Thing.h"
#include "WebThingAdapter.h"
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
@PeskyPotato
PeskyPotato / zshrc
Created February 28, 2020 10:04 — forked from LukeSmithxyz/zshrc
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
@PeskyPotato
PeskyPotato / giffer.sh
Created June 24, 2019 08:54
Bash script to make a gif from a section of a video using ffmpeg
#!/bin/bash
scale=640
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]
then
echo "Arugments <start time> <duration> <file>"
fi
ffmpeg -ss "$1" -t "$2" -y -i "$3" -vf fps=24,scale="$scale":-1:flags=lanczos,palettegen palette.png
@PeskyPotato
PeskyPotato / webm.md
Created June 23, 2019 19:16 — forked from ndarville/webm.md
4chan’s guide to converting GIF to WebM - https://boards.4chan.org/g/res/41212767

Grab ffmpeg from https://www.ffmpeg.org/download.html

It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.

The most trivial operation would be converting gifs:

ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
  • -crf values can go from 4 to 63. Lower values mean better quality.
  • -b:v is the maximum allowed bitrate. Higher means better quality.
@PeskyPotato
PeskyPotato / stars.py
Last active October 13, 2020 07:57
Save all GitHub user stars to JSON
from time import sleep
from urllib.request import urlopen, Request, urlretrieve
import requests
from bs4 import BeautifulSoup as soup
import re
import sys
import json
stars_list = []
count = 0
@PeskyPotato
PeskyPotato / linfoxdomain-scraper.py
Created May 20, 2019 11:10
Downloads all flash games from linfoxdomain.com
from time import sleep
from urllib.request import urlopen
from urllib.request import Request
from urllib.request import urlretrieve
import requests
from bs4 import BeautifulSoup as soup
import os
def scrape(category, down_path):
if not os.path.exists(down_path):
@PeskyPotato
PeskyPotato / http_server.c
Last active June 10, 2018 08:29
A simple HTTP Server in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
int main() {
// Char array to hold html file text