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
| # some methods on *nix systems to block a host/network | |
| # set a bogus arp address (for IPs in local subnet only) | |
| arp -s 192.168.1.10 00:00:00:00:00:01 | |
| # blackhole this subnet | |
| ip route add blackhole 192.168.2.0/24 |
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
| -------------------------------------------------------------------------------------------------------- | |
| # Enable apparmor in Debian on BeagleBoneBlack. Tested on | |
| # | |
| # image: bone-debian-9.5-iot-armhf-2018-10-07-4gb.img | |
| # system: BeagleBone Black (AM335x 1GHz ARM® Cortex-A8) | |
| root@beaglebone:~# apt-get install -y apparmor apparmor-utils | |
| root@beaglebone:~# aa-status |
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 | |
| tail -n0 -F "/var/log/mpdscribble/play.log" | while read LINE; do | |
| (echo "$LINE" | grep -e "$3") && curl -X POST --silent --data-urlencode \ | |
| "payload={\"channel\": \"#mp3-play\", \"username\": \"my-jukebox\", \"icon_emoji\": \":speaker:\",\"text\": \"$(echo $LINE | cut -d " " -f2- | sed "s/\"/'/g")\"}" "https://hooks.slack.com/services/zz/zz/zz"; | |
| done |
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
| sudo sh -c "echo none > /sys/class/leds/beaglebone\:green\:usr0/trigger" |
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 | |
| apt-get install -y ufw; | |
| # default | |
| ufw default deny outgoing | |
| ufw default deny incoming | |
| # inbound | |
| ufw allow 8080/tcp |
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
| # ~/.screenrc | |
| # | |
| # look and feel | |
| caption always "%{= bb}%{+b w}%h ${USER}@%H %= %c %{=b rw} %l %{= db}%{= dg}" | |
| hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<" | |
| # | |
| # skip the startup message | |
| startup_message off | |
| # | |
| # go to home dir |
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
| Setuid reboot wrapper script | |
| The reboot_setuid.c file (11 lines): | |
| ``` | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <sys/types.h> | |
| #include <unistd.h> |
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
| pi@host:~ $ curl -X GET --unix-socket /opt/path/some.socket http/hello/curltest | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Hello from flask</title> | |
| <link rel="stylesheet" type="text/css" href="/static/style.css"> | |
| </head> | |
| <body> | |
| <h1>Hello curltest!</h1> | |
| </body> |
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
| --- | |
| # everything needed for n0de.cloud Hugo web dev | |
| # | |
| # $ ansible-playbook webdev_playbook.yml -i localhost | |
| - name: hugo webdev complete | |
| hosts: localhost | |
| connection: local |
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 | |
| # | |
| # Writing to this will cause the kernel to | |
| # free pagecache, dentries and inodes. | |
| # This causes that memory to become free. | |
| # | |
| # non-destructive & safe for production: | |
| # ref: https://www.kernel.org/doc/Documentation/sysctl/vm.txt | |
| freebefore=`free -k | awk '/^Mem:/{print $4}'` |