This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import hashlib | |
import base64 | |
import os.path | |
import urllib.request, urllib.parse | |
import xml.etree.ElementTree as ET | |
URL='http://www.napiprojekt.pl/api/api-napiprojekt3.php' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Forking in PHP 7 done right. Requires PHP >= 7.1 and Process Control extension (pcntl) | |
* | |
* @author Sebastian Pająk | |
* Good article in the subject that inspired me: https://ruslanspivak.com/lsbaws-part3 | |
*/ | |
// Enable asynchronous signal handling (as of PHP 7.1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
rem Batch script (.bat or .cmd) command line arguments variables | |
rem %* - for all command line parameters (excluding the script name itself) | |
rem %0 - the command used to call the batch file | |
rem %1 - is the first command line parameter | |
rem %2 - is the second command line parameter, and so on till %9 (and SHIFT can be used for those after the 9th) | |
rem %~nx0 - the actual name of the batch file, regardless of calling method (some-batch.bat) | |
rem %~dp0 - drive and path to the script including trailing backslash (d:\scripts\) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This program is free software. It comes without any warranty, to | |
# the extent permitted by applicable law. You can redistribute it | |
# and/or modify it under the terms of the Do What The Fuck You Want | |
# To Public License, Version 2, as published by Sam Hocevar. See | |
# http://sam.zoy.org/wtfpl/COPYING for more details. | |
#Background | |
for clbg in {40..47} {100..107} 49 ; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
// Include Our Plugins | |
var jshint = require('gulp-jshint'); | |
var sasslint = require('gulp-sass-lint'); | |
var sass = require('gulp-sass'); | |
var concat = require('gulp-concat'); | |
var uglify = require('gulp-uglify'); | |
var rename = require('gulp-rename'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Fib: | |
"""Iterator that yields numbers in the Fibonacci sequence""" | |
def __init__(self, max): | |
self.max = max | |
def __iter__(self): | |
self.a = 0 | |
self.b = 1 | |
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script installs Entware-ng (https://github.com/Entware/Entware-ng) | |
# on Synology DSM 6.2 under /opt directory. | |
# Must be run with sudo. Can be used as a scheduled task on system boot. | |
printf -- "---------------------------\n" | |
printf -- "| Installing Entware-ng.. |\n" | |
printf -- "---------------------------\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Long running task with single MySQL transaction. Only one task with the same name | |
* can be running at a time. Next executed task waits untill previous finishes, or | |
* doesn't wait, but throws DomainException instead. | |
* | |
* Use it like so: | |
* $task = new Task('foo', $db); | |
* $task->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple, custom, bulletproof PHP 7 runtime errors/exceptions handling done right (I hope so :). | |
* By handling I mean logging to systemd journal or stderr, and die if any exception, | |
* error, warning, and even notice or strict occurs. This is not all-in-one | |
* or an ultimate solusion, but a good base to start with. | |
* Logs go to stderr or systemd journal (recommended, but optional). Systemd extension | |
* for PHP can be found at https://github.com/systemd/php-systemd | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create user runtime directory | |
sudo install -d -o www-data -g www-data -m 0700 /run/user/`id -u www-data` | |
# Start user manager | |
sudo systemctl start user@`id -u www-data` | |
# Optionally enable lingering (User manager is spawned for the user at boot and kept around after logouts). | |
sudo loginctl enable-linger www-data | |
# Test it |
OlderNewer