Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View noodny's full-sized avatar
🚀

Krzysiek Jakubik noodny

🚀
  • NearForm
  • Zakopane, Poland
View GitHub Profile
@noodny
noodny / media-watch.js
Created July 29, 2021 17:23
Update samba shares as drives are mounted / unmounted on an RPi
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);
@noodny
noodny / watchers.xml
Last active April 24, 2020 08:59
WebStorm linting file watchers
<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$" />
@noodny
noodny / eject.json
Created August 26, 2019 10:14
Karabiner complex eject
{
"title": "Eject over ssh",
"rules": [
{
"description": "left control + left shift + 1 - launches a new Google Chrome window",
"manipulators": [
{
"from": {
"key_code": "eject",
@noodny
noodny / TransmissionHelper.scpt
Created February 26, 2018 16:44
Link magnet files to a transmission deamon running rpc
on open location magnet_link
set hostname to "192.168.0.6"
set portname to "9091"
set rpc_url to "http://" & hostname & ":" & portname & "/transmission/rpc"
set cmd to "curl --silent " & rpc_url & " | sed 's/.*<code>//g;s/<\\/code>.*//g'"
set session_id to do shell script cmd
@noodny
noodny / file-size.sh
Created November 8, 2017 09:00
Use CURL to get file size of a given url
#!/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]}"
@noodny
noodny / style.css
Last active April 13, 2017 12:25
Jenkins pipeline styles
body {
background: red!important;
}
div.change-commit-id {
max-width: 20px;
overflow: hidden;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
@noodny
noodny / swiss.pls
Created February 11, 2016 14:25
swiss radio
[playlist]
File1=http://stream.srg-ssr.ch/m/rsj/mp3_128
@noodny
noodny / nginx.conf
Created June 8, 2015 05:28
Disable default server in nginx
server {
listen 80 default_server;
server_name _;
deny all;
}
@noodny
noodny / nginx.conf.template
Created June 2, 2015 19:56
Sample nginx configuration template file used by Dokku
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
@noodny
noodny / firewall.sh
Last active August 29, 2015 14:22
DigitalOcean firewall configuration
# 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