Skip to content

Instantly share code, notes, and snippets.

Avatar

Arno Moonen itavero

View GitHub Profile
@itavero
itavero / MvcOptionsExtensions.cs
Last active May 7, 2020
Global route prefix in ASP.NET Core 2.0
View MvcOptionsExtensions.cs
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Routing;
namespace MyWebApi.Extensions
{
public static class MvcOptionsExtensions
{
public static void UseGeneralRoutePrefix(this MvcOptions opts, IRouteTemplateProvider routeAttribute)
@itavero
itavero / transmission-autoremove.sh
Created Apr 20, 2017
Transmission auto remove
View transmission-autoremove.sh
#!/usr/bin/env sh
SERVER="9091 --auth user:pass"
TORRENTLIST=`transmission-remote $SERVER --list | grep 100% | sed "s/^ *//g" | cut -w -f1`
for TORRENTID in $TORRENTLIST
do
echo "Processing $TORRENTID"
TORRENT_INFO=`transmission-remote $SERVER --torrent $TORRENTID --info`
@itavero
itavero / set_java_home.bat
Created Jun 14, 2016
Set JAVA_HOME on a Windows machine based on registry keys
View set_java_home.bat
@echo off
setlocal
:: Check if JAVA_HOME is already defined
IF DEFINED JAVA_HOME (exit /b 0)
:: Get the JDK version from the registry
set KEY="HKLM\SOFTWARE\JavaSoft\Java Development Kit"
set VALUE=CurrentVersion
View uncrustify.cfg
#
# General options
#
# The type of line endings
newlines = crlf # auto/lf/crlf/cr
# The original size of tabs in the input
input_tab_size = 3 # number
@itavero
itavero / modem_spammer.py
Created Feb 16, 2016
Tele2 Modem Spammer
View modem_spammer.py
import urllib2
import re
import collections
from pushbullet.pushbullet import PushBullet
from time import sleep
base_url = 'http://192.168.1.1/'
pushbullet_key = 'YOUR_KEY'
# Set-up basic authentication
@itavero
itavero / lpc1549_custom.tcl
Created Jan 4, 2016
OpenOCD Target configuration for NXP LPC1549
View lpc1549_custom.tcl
# NXP LPC1549 (based on lpc1xxx.cfg)
set _CHIPNAME lpc1549
set _WORKAREASIZE 0x9000
set _CHIPSERIES lpc1500
set _BANKSIZE 0x40000
source [find target/swj-dp.tcl]
if { [info exists CCLK] } {
# Allow user override
@itavero
itavero / headless_pi.sh
Created Nov 27, 2015
Remove all of the graphical stuff from Raspbian
View headless_pi.sh
#!/usr/bin/env
# Still a work in progress...
sudo apt-get remove -y --auto-remove --purge libx11-*
sudo apt-get autoremove -y --purge
# Run raspi config to disable boot via GUI
sudo raspi-config
@itavero
itavero / pip.sh
Created Oct 5, 2014
One liner to install Python PIP
View pip.sh
python < <(curl -s https://bootstrap.pypa.io/get-pip.py)
@itavero
itavero / oshprice.ulp
Last active Aug 7, 2019
Eagle CAD ULP script to calculate the price of a PCB when you order it at OSHPark.Currently only works for 2-layer boards.
View oshprice.ulp
#usage "en: <b>Calculate the price of a dual-layer PCB if you order them at OSH Park.</b>"
"<p>Usage: run oshprice</p>"
"<p>Author: <author>Arno Moonen &lt;info@arnom.nl&gt;</author><br />"
"Version: <em>201405042026</em></p>"
// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED
void main() {
if(!board) {
// No board
@itavero
itavero / JAXBCollection.java
Last active Dec 23, 2019
Generic serializer / marshaller / unserializer / unmarshaller class to convert objects into strings and vice versa. Uses the JAXB lib. Personally used this class for converting messages received/sent to a queue (JMS).
View JAXBCollection.java
/*
* Copyright (c) 2013, Arno Moonen <info@arnom.nl>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
You can’t perform that action at this time.