Skip to content

Instantly share code, notes, and snippets.

@tuxmartin
tuxmartin / index.php
Last active January 30, 2016 16:19
WakeOnLan PHP
<?php
/*
# visudo
www-data ALL=NOPASSWD: /usr/sbin/etherwake
*/
$password = "test123";
if ( $_POST["computer"] ) {
if ( $_POST["password"] == $password ) {
@tuxmartin
tuxmartin / post.jsp
Created February 9, 2016 17:41
Vypis zalomeni radku pomoci <c:out> v JSP pomoci JavaScriptu
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="true" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<fmt:setLocale value="cs"/>
@tuxmartin
tuxmartin / 99-bluetooth.conf
Created February 21, 2016 18:34
Bluetooth - L2PING
# /etc/rsyslog.d/99-bluetooth.conf :
:msg,contains,"BLUETOOTH_PRESENCE" /var/log/bluetooth_presence.log
@tuxmartin
tuxmartin / gist:674fdef0338866705f0d
Created February 23, 2016 14:58
USB UART udev symlink
martin@pc:~$ lsusb
...
Bus 001 Device 005: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
martin@pc:~$
# /etc/udev/rules.d/99-usb-serial.rules :
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="seriak"
vytvori /dev/seriak
@tuxmartin
tuxmartin / dotaz.sql
Last active February 23, 2016 20:12
MySQL - vypsani mailu oddelenych carkou
SELECT email INTO OUTFILE '/tmp/users.txt'
LINES TERMINATED BY ', '
FROM user;
#!/bin/bash
export LANG=C
while [[ true ]] ; do
kill `ps aux | grep "google-chrome" | awk '{print $2}' | head -n 1`
if [ $? -eq 1 ]
then
break
fi
@tuxmartin
tuxmartin / scope_with_brackets.cpp
Last active February 25, 2016 12:40
C++ - Scope with Brackets
#include <iostream>
using namespace std;
int main(void)
{
cout << "Scope with Brackets" << endl;
{
int i = 111;
@tuxmartin
tuxmartin / nginx.conf
Last active March 17, 2016 14:15
APT HTTPS - overovani pomoci klientskych SSL certifikatu
root@martin:/etc/nginx# cat /etc/nginx/nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
@tuxmartin
tuxmartin / todo.txt
Created March 22, 2016 09:16
JDownloader Ubuntu 12.04 LTS server
1) vytvorit ucet na http://my.jdownloader.org/
2) pridat uzivatele
# adduser dl
3) stahnout instalator, nainstalovat a prihlasit se:
# su dl
$ wget http://installer.jdownloader.org/JDownloader.jar
$ java -jar JDownloader.jar
4) ja pouzivam skript na spusteni:
cat /home/dl/jdownloader2/start.sh
#include <stdio.h>
#include <stdint.h>
#define COUNT 5
int main(void) {
int mask = 0;
for (int j = 0; j < 32; j++) {
printf("mask[%02d] = ", mask);