Skip to content

Instantly share code, notes, and snippets.

@bcomnes
bcomnes / .bash_profile
Last active October 6, 2021 15:38
bashrc utopia
#
# ~/.bash_profile
#
# Do everything in bashrc
[[ -f ~/.bashrc ]] && . ~/.bashrc
# /etc/systemd/system/update-ddns.service
[Unit]
Description=Update DDNS
Documentation=https://dns.he.net/docs.html
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
ExecStart=/bin/bash /root/update-ddns.sh
@bcomnes
bcomnes / temp-dir-test.js
Created November 7, 2015 23:21
test with temp dirs
var test = require('tape')
var tmp = require('temporary-directory')
var tempDir
var cleanupTestDir
test('set up temp dir', function (t) {
tmp('bigup', function created (err, dir, cleanup) {
t.error(err, 'temp dir created without error')
cleanupTestDir = cleanup
@bcomnes
bcomnes / index.html
Last active November 4, 2015 17:53
socket.io example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Websockets!!!11</title>
</head>
<body>
<button name="button">Click me</button>
<script src="/socket.io/socket.io.js"></script>
<script>
@bcomnes
bcomnes / client.js
Created October 29, 2015 22:48
reload on socket.io event
var ioClient = require('socket.io-client')
var socket = ioClient()
socket.on('refresh', function(data) {
window.location.reload();
})
@bcomnes
bcomnes / ip_drop.sh
Created October 25, 2015 00:38
Shell script to block IPs thanks donpdonp
echo dropping $1
sudo iptables -I INPUT -s $1 -j DROP
╭━━━┳━━━┳━━┳━━━╮
┃╭━╮┃╭━╮┣┫┣┻╮╭╮┃
┃┃╱┃┃┃╱╰╯┃┃╱┃┃┃┃
┃╰━╯┃┃╱╭╮┃┃╱┃┃┃┃
┃╭━╮┃╰━╯┣┫┣┳╯╰╯┃
╰╯╱╰┻━━━┻━━┻━━━╯
@bcomnes
bcomnes / node.service
Last active December 14, 2015 00:02
Example node systemd service
# Put in /etc/systemd/system or ~/.config/systemd/user/ if running with --user flag
[Unit]
Description=Example Node Systemd Service
[Service]
ExecStart=/usr/local/bin/node /home/project-folder/server.js
Restart=always
StandardOutput=syslog
SyslogIdentifier=logid
@bcomnes
bcomnes / requireCss.js
Last active October 12, 2015 18:15
Require the style folder exposed by package.json
var path = require('path')
function requireCss (module) {
var packagejson = module + '/package.json'
var pathName = path.dirname(require.resolve(packagejson))
var stylePath = require(packagejson).style
var style = path.join(pathName, stylePath)
return {
style: style,
path: path.dirname(style)
@bcomnes
bcomnes / .bashrc
Last active July 5, 2016 20:05
Git ssh key encryption password provided via ssh_askpass that integrates with windows credential store
# based on script from here:
# https://help.github.com/articles/working-with-ssh-key-passphrases#platform-windows
# https://github.com/lukesampson/pshazz/blob/41f5c7b832acf862a12cf4630bbe88e6e12f6e6e/plugins/ssh.ps1
# Note: ~/.ssh/environment should not be used, as it
# already has a different purpose in SSH.
env=~/.ssh/agent.env
# Note: Don't bother checking SSH_AGENT_PID. It's not used