Skip to content

Instantly share code, notes, and snippets.

@mateuszdw
mateuszdw / debian-ubuntu-security-updates-from-cli.txt
Last active November 18, 2023 09:40
Debian or Ubuntu security updates from the command line?
sudo apt list --upgradable | grep security |cut -d\/ -f1|xargs sudo apt-get install -y
# Configuration for server where Postgres is hosted.
make sure postgres is listening on 5432 port
paste `id_rsa.pub` from client server to ~/.ssh/authorized_keys
# Configuration for client server. Where web app live and you need connect it with postgres server
@mateuszdw
mateuszdw / OSX stream camera to nginx rtmp server
Last active December 31, 2022 17:38
OSX stream camera to nginx rtmp server
# nginx /etc/nginx/nginx.conf
rtmp {
server {
listen 1935;
chunk_size 4096;
allow publish <your public ip>;
deny publish all;
application live {
live on;
#### Postgres hosted on local machine
# postgres dump commands
pg_dump -U postgres_user -h localhost -Fc database_name > ./path/dump.sql
pg_restore --verbose --clean --no-acl --no-owner -h localhost -d database_name ./path/dump.sql
# restore with psql
psql -h localhost -d database_name < ./path/dump.sql
#### Postgres hosted on docker
getArtistName(currentTabId, callback) {
chrome.tabs.executeScript(
currentTabId,
{ code: `document.querySelector('.now-playing span a[href^="/artist/"]').innerText` },
callback
);
}
getSongName(currentTabId, callback) {
chrome.tabs.executeScript(
@mateuszdw
mateuszdw / puma.service
Created November 28, 2017 22:49
Systemd Puma Service
[Unit]
Description=Puma HTTP Server
After=network.target
# Uncomment for socket activation (see below)
# Requires=puma.socket
[Service]
# Foreground process (do not use --daemon in ExecStart or config.rb)
Type=simple
@mateuszdw
mateuszdw / gist:6423d82128861b47fc18
Last active August 29, 2015 14:07
goliath async upload validation CORS
module Goliath
class Request
old_post_process = instance_method(:post_process)
define_method(:post_process) do |results|
status, headers, body = *results
# Include any data here
# All requests will pass here
if env['size-error']
@mateuszdw
mateuszdw / em-hiredis.rb
Created November 5, 2013 15:35
em-synchrony/em-hiredis synchrony patch including em-hiredis commit https://github.com/mloughran/em-hiredis/commit/4b7ec0273790cfe491d686b97894e04297d07c64. Gist not fully tested.
begin
require 'em-hiredis'
rescue LoadError => error
raise 'Missing EM-Synchrony dependency: gem install em-hiredis'
end
module EventMachine
module Hiredis
def self.connect(uri = nil)