Format/result | Command | Output |
---|---|---|
YYYY-MM-DD_hh:mm:ss | date +%F_%T | 2017-10-16_21:47:43 |
YYYYMMDD_hhmmss | date +%Y%m%d_%H%M%S | 20171016_214743 |
YYYYMMDD_hhmmss (UTC version) | date --utc +%Y%m%d_%H%M%SZ | 20171016_124743Z |
YYYYMMDD_hhmmss (with local TZ) | date +%Y%m%d_%H%M%S%Z | 20171016_214743JST |
YYYYMMSShhmmss | date +%Y%m%d%H%M%S | 20171016214743 |
YYYYMMSShhmmssnnnnnnnnn | date +%Y%m%d%H%M%S%N | 20171016214743670195402 |
YYMMDD_hhmmss | date +%y%m%d_%H%M%S | 171016_214743 |
Seconds since UNIX epoch: | date +%s | 1508158063 |
This file contains hidden or 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
@reboot PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin && /usr/bin/apt update > /tmp/update.log && /usr/bin/apt -y upgrade >> /tmp/update.log |
This file contains hidden or 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
Sorry dont have a name to give credit too but sourced from: https://askubuntu.com/questions/766334/cant-login-as-mysql-user-root-from-normal-user-account-in-ubuntu-16-04/801950 | |
I recently upgrade my Ubuntu 15.04 to 16.04 and this has worked for me: | |
First, connect in sudo mysql | |
sudo mysql -u root | |
Check your accounts present in your db |
This file contains hidden or 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 | |
settingsHash=`cat /etc/pihole/blacklist.txt /etc/pihole/whitelist.txt | md5sum` | |
if [ "$settingsHash" == "`cat /home/pi/current-pihole-settings.md5`" ]; then | |
echo "nothing to see" | |
else | |
echo "it changed" | |
cat /etc/pihole/blacklist.txt /etc/pihole/whitelist.txt | md5sum > current-pihole-settings.md5 | |
scp /etc/pihole/blacklist.txt /etc/pihole/whitelist.txt [email protected]:~/ | |
ssh [email protected] "sudo mv blacklist.txt whitelist.txt /etc/pihole/ && sudo service pihole-FTL restart" | |
fi |
This file contains hidden or 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 | |
7za a -tzip -pMY_SECRET -mem=AES256 secure.zip doc.pdf doc2.pdf doc3.pdf |
This file contains hidden or 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 script fixes steam so it can start up on ubuntu 16.04 | |
# Source: https://bbs.archlinux.org/viewtopic.php?id=193802 on 20171206 @ 02:43 UTC | |
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/installed/libstdc++6-4.6-pic_4.6.3-1ubuntu5+srt4_amd64 | |
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/installed/libstdc++6-4.6-pic_4.6.3-1ubuntu5+srt4_amd64.md5 | |
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/installed/libstdc++6_4.8.1-2ubuntu1~12.04+steamrt2+srt1_amd64 | |
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/installed/libstdc++6_4.8.1-2ubuntu1~12.04+steamrt2+srt1_amd64.md5 | |
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++_pic.a | |
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++_pic.map | |
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6 |
This file contains hidden or 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 | |
# Make default camera /dev/video0 point to the "best" camera present. | |
# Source: https://askubuntu.com/questions/396952/how-to-change-the-default-webcam-changing-dfaults-in-multimedia-selctor-not-wor | |
# Date: 20170611@21:02UTC | |
# By: Jason Eisner (https://github.com/jeisner) | |
if [ -h /dev/video0 ]; then | |
sudo rm /dev/video0 # not first run: remove our old symlink | |
elif [ -e /dev/video0 ]; then | |
sudo mv /dev/video0 /dev/video0.original # first run: rename original video0 |
To set up an autoplaying headless media center
- Raspberry Pi
- monitor/keyboard for setup
- Download OSMC (https://osmc.tv/download/)
- Flash it to SD card
This file contains hidden or 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
slacktoken="TOKEN/TOKEN/TOKEN" | |
slackchannel="#welcome" | |
hostname=`cat /etc/hostname` | |
diskspace=`/bin/df -h | /usr/bin/xargs -L 1 /bin/echo "\n"` | |
curl -X POST --data-urlencode 'payload={"channel": "$slackchannel", "username": "webhookbot", "text": "'"$hostname""\n""$diskspace"'", "icon_emoji": ":ghost:"}' https://hooks.slack.com/services/$slacktoken |
This file contains hidden or 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
/* | |
* Autodetect if SSL/TLS is used by having a look at the first incoming bytes | |
* This technique is from http://webview.jabberd.org/cgi-bin/viewvc.cgi/trunk/jadc2s/clients.cc?view=markup | |
* | |
* used heuristic: | |
* - an incoming connection using SSLv3/TLSv1 records should start with 0x16 | |
* - an incoming connection using SSLv2 records should start with the record size | |
* and as the first record should not be very big we can expect 0x80 or 0x00 (the MSB is a flag) | |
* - everything else is considered to be unencrypted | |
*/ |