Skip to content

Instantly share code, notes, and snippets.

@pweinzettel
pweinzettel / check_cert.php
Created Aug 4, 2020
Simple SSL web cert check from PHP
View check_cert.php
<?php
$urls = json_decode(file_get_contents('sites.json'),true);
function certdata($url) {
$parseurl = parse_url($url, PHP_URL_HOST);
$get = stream_context_create(array("ssl" => array("capture_peer_cert" => TRUE)));
$read = stream_socket_client("ssl://".$parseurl.":443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $get);
$cert = stream_context_get_params($read);
return openssl_x509_parse($cert['options']['ssl']['peer_certificate']);
@pweinzettel
pweinzettel / get_free_fa_icons.php
Created Aug 4, 2020
List all free fontawesome icons
View get_free_fa_icons.php
<?php
function proc_fa($page) {
$curl = curl_init($page);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$tmp = curl_exec($curl);
curl_close($curl);
preg_match('/window.__inline_data__ =(.*?)<\/script>/s', $tmp, $match);
$res = json_decode($match[1]);
@pweinzettel
pweinzettel / vt8.sh
Created Aug 28, 2020
Run Virtual Box (or any other gui software) on separate virtual terminal
View vt8.sh
#!/bin/bash
# To get the vmid, use:
# VBoxManage list vms
VM="{3b019d6d-16d1-4a8b-909d-8c79e53abd2d}";
XN=4;
XS=/tmp/.X11-unix;
# Create a new X server on vt8
@pweinzettel
pweinzettel / wav-mp3
Created Aug 28, 2020 — forked from championofblocks/wav-mp3
Command line bash to convert all wav to mp3
View wav-mp3
for i in *.wav; do test -f "${i%.wav}.mp3" || lame -b 320 -h "${i}" "${i%.wav}.mp3"; done
@pweinzettel
pweinzettel / droidcam.sh
Created Aug 28, 2020
Execute DroidCam on the phone and client on pc from bash
View droidcam.sh
#!/bin/bash
readonly LOG_FILE=/var/log/droidcam.log
exec 1>$LOG_FILE
exec 2>&1
port=4747
date
env
/usr/bin/id
@pweinzettel
pweinzettel / touch-monitor.sh
Created Sep 3, 2020
Map an input device to an output screen
View touch-monitor.sh
#!/bin/bash
declare $(xinput | grep -i touchscreen | awk {'print$5'})
monitor=$(xrandr | grep primary | awk {'print$1'})
xinput map-to-output ${id} ${monitor}
@pweinzettel
pweinzettel / date_sync.sh
Created Jan 26, 2021
bash sync date from google without NTP
View date_sync.sh
date -us "$(curl -Is google.com | grep '^Date:' | cut -d' ' -f3-)"
@pweinzettel
pweinzettel / namecheap.sh
Created Mar 6, 2021
namecheap dynamic dns update
View namecheap.sh
#!/bin/bash
### CONFIG INI
HOST='subdom'
DOMAIN='example.com'
PASSWD='<SECRET>'
URL='https://dynamicdns.park-your-domain.com/update'
### CONFIG END
IP=$(curl -s ifconfig.me)
View keybase.md

Keybase proof

I hereby claim:

  • I am pweinzettel on github.
  • I am peter_gs (https://keybase.io/peter_gs) on keybase.
  • I have a public key ASDJ8EomCSUUBhwiHPmHc_EQO45811XTn2GjkxqHOUkpgQo

To claim this, I am signing this object:

@pweinzettel
pweinzettel / post.js
Created Jun 26, 2021
redirect and post json data using forms
View post.js
function post(url, data) {
var form = $(document.createElement('form'));
$(form).attr("action", url);
$(form).attr("method", "POST");
$(form).prop("hidden", true);
for (const key in data) {
var input = $("<input>")
.attr("type", "text")
.attr("name", key)