Skip to content

Instantly share code, notes, and snippets.

View pingec's full-sized avatar

Matej Drolc pingec

View GitHub Profile
using System;
using System.Data;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
class Program
{
static void Main(string[] args)
{
@pingec
pingec / v4tov4_advfirewall
Created September 26, 2014 13:28
Forwards specified listenports to destport and adds inbound accept rules for listenports. Should be run as Administrator.
@echo off
set listenports=110,143,993,995,21,465
set destport=80
for %%p in (%listenports%) do (
echo "Adding forwarding rule from port %%p to %destport%..."
netsh interface portproxy add v4tov4 listenport=%%p listenaddress=89.89.89.89 connectport=%destport% connectaddress=89.89.89.89
netsh advfirewall firewall show rule name="ScreenConnect WebServer port %%p"
@pingec
pingec / Disable mstsc NLA (client)
Last active June 11, 2024 03:04
Disable NLA on remote desktop (mstsc) client (fixing password expired problem)
Sometimes you try to open a remote desktop connection to a machine only to get an error message that "the password has expired".
If the remote machine does not enforce NLA (Network Level Authentication), it is still possible to start a remote desktop session by disabling NLA on the client (currenlty not possible from the menu on my remote desktop client v.6.3.96000 that came with windows 8.1).
Add the following setting to your .rdp file ("C:\Users\<User>\Documents\Default.rdp" if you aren't using a specific one).
enablecredsspsupport:i:0
Optionally you might need to specify
@pingec
pingec / BeagleBone Black setup
Last active August 3, 2016 08:00
BeagleBone Black setup
###Tips
*check listening ports with 'netstat -lnptu'
*check running services with systemctl and ps commands
###Disable X manager
Add following to /boot/uboot/uEnv.txt:
```
## For BBB Debian OS
## This disables lightdm run from "/etc/init.d/lightdm".
@pingec
pingec / WinExplorerCtxPublisher
Last active August 29, 2015 14:21
Publish photos from windows explorer context menu
using System;
using System.Runtime.InteropServices;
namespace WinExplorerPublisher
{
//Short app to publish jpegs to the web by copying to specified folder. Constructed URL is inserted into clipboard.
//Example of registry script to register the program:
//[HKEY_CLASSES_ROOT\jpegfile\shell\Publish to pingec.si\command]
//@="\"C:\\Program Files (x86)\\pingec\\WinExplorerPublisher.exe\" \"%1\" \"D:\\www\\publish\" \"http://pingec.si/publish\""
@pingec
pingec / lircd.conf
Last active March 23, 2017 10:05
lirc config with raw codes for TOSOT air conditioner remote control (tested on raspbian)
begin remote
name ONKYO
flags RAW_CODES
eps 30
aeps 100
ptrail 0
repeat 0 0
gap 107325
@pingec
pingec / PokemonCP.md
Last active August 6, 2016 18:13
Pokemon CP, IV etc,

Let's say we have 2 pokemons of the same type. Their CP will depend on the following values:

  • IV (IndividualStamina, IndividualAttack, IndividualDefense)
  • CpMultiplier
  • AdditionalCpMultiplier

These values, together with move types, weight, height are what makes your pokemon unique.

Mechanisms that change these values:

@pingec
pingec / macspoof_osmc.md
Created March 21, 2017 22:05
Permanently spoofing mac address on OSMC @ Raspberry Pi 2
osmc@osmc:~$ uname -a
Linux osmc 4.4.27-9-osmc #1 SMP PREEMPT Tue Mar 14 20:54:19 UTC 2017 armv7l GNU/Linux
osmc@osmc:~$ grep VERSION_ID /etc/os-release
VERSION_ID="2017.03-1"
osmc@osmc:~$ cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//'
a01041
# http://elinux.org/RPi_HardwareHistory => 2 Model B

osmc@osmc:~$ cat /etc/udev/rules.d/75-mac-spoof.rules
@pingec
pingec / speedtest.sh
Last active July 26, 2017 01:45
Log speedtest on openwrt router
#!/bin/sh
# Logs speedtest results, ping and associated stations (tested on openwrt@wr1043nd)
# Example output: 2017-03-22 19:01:12 (381 KB/s) - `/dev/null' saved [27347433/27347433] round-trip min/avg/max = 48.924/50.155/53.697 ms Station 78:c3:e9:0d:d9:50 (on wlan0) Station 8c:3a:e3:61:48:88 (on wlan0) Station 24:1f:a0:7a:4e:db (on wlan0) Station 88:83:22:c2:88:de (on wlan0) Station 70:18:8b:9d:d9:34 (on wlan0) Station b4:43:0d:e4:2e:84 (on wlan0)
SPEED=$(wget http://ftp.arnes.si/pub/packages/debian/dists/Debian8.7/main/Contents-amd64.gz -O /dev/null 2>&1 | grep saved)
PING=$(ping google.com -c10 2>&1 | grep round)
STATIONS=$(iw dev wlan0 station dump | grep Station)
echo $SPEED $PING $STATIONS >> /tmp/speedtest.log
@pingec
pingec / sendtemp.sh
Last active March 22, 2017 19:52
Reporting temperatures from openwrt router
#!/bin/sh
# Gets temperature from 1wire sensor with specified address and posts it to specified url (teste on openwrt@wr1043nd)
SENSR_ADDR="28DD70770200009C"
SENSR_NUM=$(/usr/bin/digitemp_DS9097 -s /dev/ttyUSB0 -i -q | grep $SENSR_ADDR | grep ROM | cut -c6)
TEMP=$(/usr/bin/digitemp_DS9097 -t$SENSR_NUM -q -o"%.2C")