Skip to content

Instantly share code, notes, and snippets.

View wallneradam's full-sized avatar

Adam Wallner wallneradam

  • Hungary
  • 10:33 (UTC +02:00)
View GitHub Profile
@wallneradam
wallneradam / ms_timeseries_generator.py
Last active March 4, 2019 12:54
Keras Multi Step Timeseries Generator
import numpy as np
from tensorflow.python.keras import utils
class MultiStepTimeseriesGenerator(utils.Sequence):
"""Utility class for generating batches of temporal data.
This class takes in a sequence of data-points gathered at
equal intervals, along with time series parameters such as
stride, length of history, etc., to produce batches for
@wallneradam
wallneradam / qasm.YAML-tmLanguage
Last active May 14, 2018 10:57
Broadcom QPU assembler language specification file for Textmate, and compatible editors like Visual Studio Code and IntelliJ platform (CLion)
name: QASM
scopeName: source.asm.qasm
comment: 'Broadcom QPU assembly language'
fileTypes:
- qasm
- qinc
uuid: E82E7ADE-56A9-11E8-A223-1C3947C23EE3
patterns:
- include: '#comments'
@wallneradam
wallneradam / qasm.lang
Last active May 13, 2018 16:00
Broadcom QPU assembler language specification file for GtkSourceView (gedit)
<?xml version="1.0" encoding="UTF-8"?>
<language id="qasm" _name="Assembler (Broadcom QPU)" version="2.0" _section="Sources">
<metadata>
<property name="mimetypes">text/x-qasm;application/x-qinc</property>
<property name="globs">*.qasm;*.qinc</property>
<property name="line-comment-start">#</property>
</metadata>
<styles>
<style id="comment" _name="Comment" map-to="def:comment" />
@wallneradam
wallneradam / hexdump.php
Created February 7, 2018 12:38
PHP Hex Dump
<?php
/**
* Print binary data as hex string
* @param string $data
* @param string $newline
* @param int $width
*/
function hexdump($data, $newline = "\n", $width = 16) {
static $from = '';
@wallneradam
wallneradam / pkguninst.sh
Created January 18, 2018 01:03
MacOS Package Uninstaller
#!/bin/bash
############################################################
### Shell script to uninstall Mac Os X packages ###
### Based on pkgutil. ###
### Created by Adam Wallner <adam.wallner at gmail.comu> ###
### V1.0.1 ###
############################################################
IFS=$'\n'
function get_pkgid {
@wallneradam
wallneradam / systemd.lang
Last active January 14, 2018 22:20
Systemd language specification for GtkSourceView (gedit)
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of GtkSourceView
Author: Antonio Ognio <gnrfan@gnrfan.org>
Modified: Adam Wallner
Copyright (C) 2005 Antonio Ognio <gnrfan@gnrfan.org>
@wallneradam
wallneradam / nginx.lang
Last active March 26, 2021 16:52
Nginx language specification file for GtkSourceView.
<?xml version="1.0" encoding="UTF-8"?>
<language id="nginx" _name="Nginx conf file" version="2.0" _section="Other">
<metadata>
<property name="mimetypes">text/x-nginx-conf-file;application/x-nginx-conf-file</property>
<property name="globs">*.conf</property>
<property name="line-comment-start">#</property>
</metadata>
<styles>
<style id="comment" _name="Comment" map-to="def:comment"/>
@wallneradam
wallneradam / ipt-dedup.sh
Created May 29, 2017 14:32
Iptables rules deduplication script
#!/bin/sh
ipt="iptables -w"
dedup() {
iptables-save | sed -n "/$1/,/COMMIT/p" | grep "^-" | sort | uniq -dc | while read l
do
c=$(echo "$l" | sed "s|^[ ]*\([0-9]*\).*$|\1|")
rule=$(echo "$l" | sed "s|^[ ]*[0-9]* -A\(.*\)$|-t $1 -D\1|")
while [ ${c} -gt 1 ]; do
@wallneradam
wallneradam / google-maps-data-parser.js
Last active May 10, 2017 14:29 — forked from jeteon/google-maps-data-parser.js
NodeJS script to parse the Google Maps "data" URL attribute into an array.
'use strict';
/**
* Basic code to parse the values in the "data" attribute in a Google Maps URL to an Array.
* There will likely still be some work to do to interpret the resulting Array.
*
* Based on information from:
* http://stackoverflow.com/a/34275131/1852838
* http://stackoverflow.com/a/24662610/1852838
*/