Skip to content

Instantly share code, notes, and snippets.

View skorotkiewicz's full-sized avatar
💻
Programming

Sebastian Korotkiewicz skorotkiewicz

💻
Programming
View GitHub Profile
@skorotkiewicz
skorotkiewicz / allcrontab.sh
Created December 8, 2016 15:28
List crontab for all users
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done
@skorotkiewicz
skorotkiewicz / findmp3.sh
Created December 8, 2016 15:29
Find all mp3 with full path
find /home/stream/trans/music/ -type f -name "*.mp3" > /home/stream/trans/playlists/mainlist.lst
// cat mainlist.lst; # output
/path/to/music/first.mp3
/path/to/music/second.mp3
/path/to/other/music/whatever.mp3
@skorotkiewicz
skorotkiewicz / echow.php
Created December 8, 2016 15:29
<br /> for CLI and Web
<?PHP
function echow($text) {
if (isset($_SERVER{'TERM'})) {
echo $text."\t\n";
} else {
echo $text."<br />";
}
}
@skorotkiewicz
skorotkiewicz / ALTO.ino
Created December 8, 2016 15:30
ALTO - Arduino Parking Assistant
const int relayRed = 13;
const int relayYellow = 12;
const int relayGreen = 11;
const int pingPinLeft = 7;
const int pingPinRight = 8;
int distanceLeft = 0;
int distanceRight = 0;
@skorotkiewicz
skorotkiewicz / RGBblink.ino
Created December 8, 2016 15:30
RGB led (blink)
@skorotkiewicz
skorotkiewicz / allcolour.ino
Created December 8, 2016 15:31
All Colour Change
int bluePin = 12; // Blue LED connected to digital pin 13
int redPin = 10; // Red LED connected to digital pin 12
int greenPin = 11; // Green LED connected to digital pin 11
int canode = 13; // Green LED connected to digital pin 11
void setup() // run once, when the sketch starts
{
pinMode(redPin, OUTPUT); // sets the digital pin as output
pinMode(greenPin, OUTPUT); // sets the digital pin as output
@skorotkiewicz
skorotkiewicz / 2017.sh
Created December 8, 2016 15:40
Countdown to new year 2017!
while [[ $(date +%Y) -ne 2017 ]];do figlet $(($(date -d 2017-01-01 +%s)-$(date +%s)));sleep 1;clear;done;figlet 'Happy New Year!'
@skorotkiewicz
skorotkiewicz / .bashrc
Created January 4, 2017 03:44
my .bashrc
alias ser='cd /etc/apache2/sites-e*;ls'
alias serR='/etc/init.d/apache2 restart'
alias serlog='tail -f /var/log/apache2/access.log'
alias authlog='tail -f /var/log/auth.log'
alias path='echo -e ${PATH//:/\\n}'
function unzip2dir() {
ls $1|awk -F'.zip' '{print "unzip "$0" -d "$1}'|sh
}
function myip() {
local ip=$(curl http://ip.itunix.eu)
@skorotkiewicz
skorotkiewicz / functions.bash
Created January 4, 2017 04:24 — forked from dotgc/functions.bash
useful bash functions
### Extract Archives ###
function extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjvf $1 ;;
*.tar.gz) tar xzvf $1 ;;
*.bz2) bzip2 -d $1 ;;
*.rar) unrar2dir $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
@skorotkiewicz
skorotkiewicz / php-first.md
Created February 12, 2017 19:30 — forked from adrian-enspired/php-first.md
PHP _first_!

PHP First

Generally speaking, your PHP code can be sorted into two categories:

  • code which does work (processing input, controller logic, database access, error handling, etc.), and
  • code which produces output (echo, <?= $var ?>, plain <html>, etc.).

work goes FIRST. output goes LAST.