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 a swapfie | |
sudo fallocate -l 1G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
# make it permanent | |
echo "/swapfile none swap sw 0 0" >> /etc/fstab | |
# tweak it | |
echo "vm.swappiness=10" >> /etc/sysctl.conf |
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
# block all connections from the outside (incomming) | |
# and inside (outgoing) | |
ufw default deny incoming | |
ufw default allow outgoing | |
# open ssh and web related ports | |
ufw allow ssh | |
ufw allow www | |
# list ports status |
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
server { | |
listen [::]:80; | |
listen 80; | |
server_name $NOSSL_SERVER_NAME; | |
access_log /var/log/nginx/${APP}-access.log; | |
error_log /var/log/nginx/${APP}-error.log; | |
# set a custom header for requests | |
add_header X-Served-By www-ec2-01; | |
# set max POST body size |
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
[playlist] | |
File1=http://stream.srg-ssr.ch/m/rsj/mp3_128 |
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
body { | |
background: red!important; | |
} | |
div.change-commit-id { | |
max-width: 20px; | |
overflow: hidden; | |
display: inline-block; | |
white-space: nowrap; | |
text-overflow: ellipsis; |
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/sh | |
bytesToHuman() { | |
b=${1:-0}; d=''; s=0; S=(Bytes {K,M,G,T,E,P,Y,Z}iB) | |
while ((b > 1024)); do | |
d="$(printf ".%02d" $((b % 1024 * 100 / 1024)))" | |
b=$((b / 1024)) | |
let s++ | |
done | |
echo "$b$d ${S[$s]}" |
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
{ | |
"title": "Eject over ssh", | |
"rules": [ | |
{ | |
"description": "left control + left shift + 1 - launches a new Google Chrome window", | |
"manipulators": [ | |
{ | |
"from": { | |
"key_code": "eject", |
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
<TaskOptions> | |
<TaskOptions> | |
<option name="arguments" value="--fix $FilePathRelativeToProjectRoot$" /> | |
<option name="checkSyntaxErrors" value="true" /> | |
<option name="description" /> | |
<option name="exitCodeBehavior" value="ERROR" /> | |
<option name="fileExtension" value="js" /> | |
<option name="immediateSync" value="false" /> | |
<option name="name" value="ESLint" /> | |
<option name="output" value="$FilePathRelativeToProjectRoot$" /> |
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 { readdirSync, watch, readFileSync, writeFileSync } from 'fs'; | |
import { exec } from 'child_process'; | |
const PATHNAME = '/media/pi'; | |
const SMB_CONF = '/etc/samba/smb.conf'; | |
let currentMedia = []; | |
function getMedia() { | |
return readdirSync(PATHNAME); |
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
server { | |
listen 80 default_server; | |
server_name _; | |
deny all; | |
} |
OlderNewer