Skip to content

Instantly share code, notes, and snippets.

@saerdnaer
saerdnaer / chaos.pgsql
Last active June 30, 2024 22:19 — forked from FelixHenninger/chaos.sql
Inventory database proposal
-- modified from SQLite to PostgreSQL, --Andi 2024-07-01
-- Common metadata -------------------------------------------------------------
-- Units
CREATE TABLE units (
id INTEGER PRIMARY KEY NOT NULL,
-- Metadata
name VARCHAR NOT NULL UNIQUE,
CREATE INDEX "items_alternate_ids_idx" ON "items" USING GIN ("alternate_ids");
CREATE OR REPLACE FUNCTION items_by_ids(ids text[], is_published boolean DEFAULT NULL)
RETURNS SETOF items
AS $$
SELECT items.*
FROM unnest($1) WITH ORDINALITY t(value, ord), items
WHERE (
items.core_id = t.value
OR items.id = CASE WHEN isnumeric(t.value) THEN t.value::integer ELSE null END
<?php
/*
SELECT meta_value, u.user_login, u.user_registred, u.display_name
FROM wp_usermeta um LEFT JOIN wp_users u ON u.id = um.user_id
WHERE um.meta_key = 'session_tokens';
*/
$file = file('wp-usermeta.csv');
@saerdnaer
saerdnaer / yt2text.py
Last active October 18, 2024 10:43
download german transcript from youtube and convert to better readable text
'''
Downloads YouTube subtitles to human readable text, while fixing casing of german words.
Example usage:
python3 yt2text.py _RlwgfYd65Q > ultraschall5.txt
'''
import argparse
from youtube_transcript_api import YouTubeTranscriptApi
@saerdnaer
saerdnaer / control-display.sh
Last active January 12, 2020 17:49
control hdmi display via cec from raspberry pi
#/bin/bash
# see https://www.screenly.io/blog/2017/07/02/how-to-automatically-turn-off-and-on-your-monitor-from-your-raspberry-pi/#cec-client
# and crontab -e (of user "pi") --Andi
case "$1" in
on)
echo 'on 0' | cec-client -s -d 1
;;
off)
echo 'standby 0' | cec-client -s -d 1
<?php
define('DOKU_INC', '../dokuwiki/');
define('DOKU_PLUGIN', '../');
require_once(DOKU_INC . 'inc/load.php');
require_once(DOKU_PLUGIN.'sqlite/helper.php');
class data_api {
@saerdnaer
saerdnaer / controllers.application.js
Last active August 28, 2017 12:25
ember-paper bug: button inside of leaflet opup
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
# coding=utf-8
import config
from flask import Flask, Response, request, json
import requests
import ssl
app = Flask(__name__)
# basiert auf https://twitter.com/realgiggls/status/693081083211051008
date
for ((i=25;i>0;i--)); do
echo $i
sleep 60
done
say -v Anna "Timer abgelaufen"
xmessage "Timer abgelaufen $(date '+%H:%m')"
# -*- coding: UTF-8 -*-
#import requests
import json
from collections import OrderedDict
def main():
data = None
session = "7306" #wget https://lab.dsst.io/32c3-slides/slides/7306.json