Skip to content

Instantly share code, notes, and snippets.

View rudasn's full-sized avatar

Nicolas Rudas rudasn

View GitHub Profile
@fuero
fuero / refresh-wirehub-config.sh
Created January 23, 2024 15:42
Refresh config from wirehub
#!/bin/bash
set -euo pipefail
IF=<if>
URL="https://wirehub.org/<user>/n/<net>/device/<id>/download?invite_code=<code>"
TMPFILE="$(mktemp)"
SPLITDIR="$(mktemp -d)"
DEST=/etc/wireguard/"$IF".conf
cleanup() {
rm -f "${TMPFILE}"
// per https://docs.npmjs.com/misc/scripts, npm exposes a bunch of variables to
// the environment prefixed with npm_config_*, npm_package_* and npm_lifecycle_*.
// Here's a list of all variables exposed in my setup.
npm_config_access=
npm_config_allow_same_version=
npm_config_also=
npm_config_always_auth=
npm_config_argv='{"remain":[],"cooked":["run","foo"],"original":["run","foo"]}'
npm_config_auth_type=legacy
@cubarco
cubarco / simplehttpserver.go
Created December 3, 2015 03:03
This is a golang alternative to the SimpleHTTPServer of Python.
package main
import (
"flag"
"fmt"
"net/http"
)
func main() {
var port string
@tomasinouk
tomasinouk / snat_dnat_advantech.md
Last active June 30, 2024 19:54
examples of SNAT, DNAT with iptables for Advantech, Conel routers, with comments (probably will work on other routers where iptables can be manipulated, care needs to be taken on applying these commands after reboot).

Some examples of SNAT, DNAT with iptables with comments

mainly used in start-up script

How to test 'safely'

When we play with iptables aka firewall we might end up in situation, where we execute rule, which has unforseen impact - lock yourself out. Recovering from this situation is necessity.

How to:

  • Enable reboot via SMS.
  • Test all commands in shell first before putting them into Start-up script. This way the command will be wiped out, when unit is rebooted.

masquarade all outgoing packets to be WLAN0 IP

@parkji
parkji / Gruntfile.js
Last active December 20, 2015 22:59
Grunt file for building and serving jekyll sites. Means you can just do grunt watch instead of running two Jekyll commands
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
shell: {
jekyllBuild: {
command: 'jekyll build'
},
jekyllServe: {
command: 'jekyll serve'
}
@gdamjan
gdamjan / README.md
Last active July 9, 2024 22:54
Setup for an easy to use, simple reverse http tunnels with nginx and ssh. It's that simple there's no authentication at all. The end result, a single ssh command invocation gives you a public url for your web app hosted on your laptop.

What

A lot of times you are developing a web application on your own laptop or home computer and would like to demo it to the public. Most of those times you are behind a router/firewall and you don't have a public IP address. Instead of configuring routers (often not possible), this solution gives you a public URL that's reverse tunnelled via ssh to your laptop.

Because of the relaxation of the sshd setup, it's best used on a dedicated virtual machine just for this (an Amazon micro instance for example).

Requirements

@blackfalcon
blackfalcon / sassJunkDrawer.md
Last active March 23, 2022 20:09
Clean out your Sass junk-drawer

by Dale Sande

CSS has had a long and sordid past. A developer never sets out with the goal of making a complete and total mess of things. Their intention is not to build something that is practically illegible, impractical to maintain and is limited in scale. But somehow, this is where many inevitably end up. Luckily, all is not lost. With some simple strategies, organizational methods and out-of-the box tools, we can really help get that junk-drawer inline.

For many of us getting started with Sass, at one time or another have created a junk-drawer of files. For most, this was a rookie mistake, but for others, this is a continuing issue with our architecture and file management techniques. Sass doesn't come with any real rules for file management so developers are pretty much left to their own devices.

Large CSS files and increased complexity

CSS started out with very simple intentions, but as [tableless web design][1.1] began to really take a foothold, o

@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
class Example.Views.Table extends Backbone.View
template: JST['example/table']
initialize: ->
@collection.on 'add', @addOne
render: ->
@$el.html @template()
@addAll()
@
@jcromartie
jcromartie / tables.js
Created June 14, 2012 17:01
Backbone views done right done right?
var TableViewRow = Backbone.View.extend({
tagName: "tr",
template: _.template("<td><%= firstName %></td><td><%= lastName %></td>"),
render: function() {
this.$el.html(this.template(this.model.toJSON()));
return this;
}
});