Skip to content

Instantly share code, notes, and snippets.

View tyriis's full-sized avatar
🏡
Working from home

Nils Müller tyriis

🏡
Working from home
View GitHub Profile
function log(value)
if( DEFAULT_CHAT_FRAME ) then
DEFAULT_CHAT_FRAME:AddMessage(value);
end
end
function debug(value, indent, returnResult)
local linePrefix = "- "
local typeValue = type(value)
@tyriis
tyriis / init.lua
Created August 30, 2016 07:07 — forked from creationix/init.lua
Websocket server in nodemcu using new crypto module.
wifi.setmode(wifi.STATION)
wifi.sta.config("creationix","noderocks")
wifi.sta.connect()
tmr.alarm(0, 1000, 1, function ()
local ip = wifi.sta.getip()
if ip then
tmr.stop(0)
print(ip)
dofile("websocket.lc")
dofile("main.lc")
@tyriis
tyriis / configure
Last active November 21, 2017 11:43
nginx configure
./configure \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/data/nginx/nginx.conf \
--error-log-path=/data/nginx/log/error.log \
--http-log-path=/data/nginx/log/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/data/nginx/cache/client_temp \
--http-proxy-temp-path=/data/nginx/cache/proxy_temp \
@tyriis
tyriis / proxy
Created November 23, 2017 22:03 — forked from boneskull/proxy
example nginx config to reverse proxy a node-red server (websocket support)
server {
listen 80;
server_name your_server_name;
access_log /var/log/nginx/access.log;
location / {
proxy_pass http://localhost:1880;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
@tyriis
tyriis / proxy
Created November 23, 2017 22:03 — forked from boneskull/proxy
example nginx config to reverse proxy a node-red server (websocket support)
server {
listen 80;
server_name your_server_name;
access_log /var/log/nginx/access.log;
location / {
proxy_pass http://localhost:1880;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
@tyriis
tyriis / myCA.md
Last active June 4, 2018 09:05
Create local CA for trusted self signed https certificates

create myCA private key

openssl genrsa -des3 -out myCA.key 2048

create myCA certificate

openssl req -x509 -new -nodes -key myCA.key -sha256 -days 1825 -out myCA.pem
@tyriis
tyriis / pacaur_install.sh
Created July 31, 2018 20:40 — forked from tadly/pacaur_install.sh
A simple shell script to quickly / easily install "pacaur" on archlinux
#!/bin/sh
#
# !!! IMPORTANT !!!
# As of 2017-12-14, pacaur is unmaintained (https://bbs.archlinux.org/viewtopic.php?pid=1755144#p1755144)
# For alternatives see the arch wiki: https://wiki.archlinux.org/index.php/AUR_helpers#Active
# pacaur seems to get occasional updates to fix breaking changes due to pacman updates though.
#
# If you are new to arch, I encourage you to at least read and understand what
# this script does befor blindley running it.
# That's why I didn't make a one-liner out of it so you have an easier time
@tyriis
tyriis / psql_db_user.sql
Last active November 2, 2018 20:47
Creating user, database and adding access on PostgreSQL
-- source: https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e
CREATE DATABASE yourdbname;
CREATE USER youruser WITH ENCRYPTED PASSWORD 'yourpass';
GRANT ALL PRIVILEGES ON DATABASE yourdbname TO youruser;
@tyriis
tyriis / read_cookies.js
Last active November 8, 2018 13:17
read cookies
var cookies = document.cookie.split(';').reduce(function(cookies, cookie) {
cookies[cookie.split("=")[0].trim()] = unescape(cookie.split("=")[1]);
return cookies
}, {})
console.log(cookies.sec_session_id)
@tyriis
tyriis / proto.java
Last active November 12, 2018 22:22
package dslab.DMTP;
import dslab.entities.Message;
import dslab.entities.User;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.Socket;
import java.util.ArrayList;