Skip to content

Instantly share code, notes, and snippets.

View p410n3's full-sized avatar

Phillip L. p410n3

View GitHub Profile
@p410n3
p410n3 / script.js
Last active June 12, 2020 06:31
MLZ Telegram Deno Bot
// Lazier Debugging
const log = console.log;
// Constants
const url = 'https://www.muensterlandzeitung.de/';
const botUrl = 'https://api.telegram.org/<bot-token>/sendMessage?chat_id=@muensterlandzeitung&text=';
const historyFile = './history.json';
let history = [];
@p410n3
p410n3 / mdtopdf.sh
Last active September 12, 2019 12:24
Small script that uses pandoc and dmenu to comfortably convert .md to .pdf
#!/bin/bash
# First arg is the folder
_folder=$1
# If _folder is empty, use pwd as default
if [[ -z $_folder ]]; then
_folder=`pwd`;
fi
@p410n3
p410n3 / dwmStatus.sh
Last active September 12, 2019 12:23
[dwm] minimal status bar
#!/bin/bash
while [ 1 ]; do
# Battery
_battery=`acpi | egrep -o '[0-9]{1,3}\%'`
# Time
_time=`date +'%R'`
xsetroot -name " $_battery | $_time"
const fetch = require('node-fetch');
const fs = require('fs');
/*
* Reads a list of URLs from a file and return the CSP header if present
* Written by Phillip L - 14.15.2019
*/
const file = 'urls.csv';
@p410n3
p410n3 / criticalcss-bookmarklet-devtool-snippet.js
Created October 9, 2018 09:08 — forked from PaulKinlan/criticalcss-bookmarklet-devtool-snippet.js
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@p410n3
p410n3 / grid.css
Last active July 7, 2018 23:21
My default CSS-Grid layout
body {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.grid {
width: 100%;
min-height: 100vh;
@p410n3
p410n3 / fetch.js
Created May 23, 2018 20:55
Fetch API so I dont ferget it again
var requestBody =
'1=' + stuff1 + '&' +
'2=' + stuff2 + '&' +
'3=' + stuff3;
fetch('https://some-api.tld', {
method: 'post',
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
},
@p410n3
p410n3 / parallax.html
Last active April 20, 2018 11:25
My parallax JS
<div class="box-three parralax" id="parallax-three">
<div class="container">
<h2>Bla bla</h2>
</div>
</div>
@p410n3
p410n3 / index.js
Last active December 8, 2017 10:38
nodeJS: Find bad HTPP status
var fetchUrl = require("fetch").fetchUrl;
var fs = require('fs');
//Domain list from file
var domains = fs.readFileSync('domains.txt').toString().split("\n");
for (i = 0; i < domains.length; i++) {
fetchUrl(domains[i], function(error, meta){
//Without the try catch you encounter crashes due to weird async problmes (at least thats my guess)
try {