Skip to content

Instantly share code, notes, and snippets.

View my-linux-commands
pg_dump -U postgres_user -h localhost -Fc database_name > dump.sql
pg_restore --verbose --clean --no-acl --no-owner -h localhost -d database_name ./path/db.sql
View spotify selectors
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 Nov 28, 2017
Systemd Puma Service
View 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 Aug 29, 2015
goliath async upload validation CORS
View gist:6423d82128861b47fc18
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 Nov 5, 2013
em-synchrony/em-hiredis synchrony patch including em-hiredis commit https://github.com/mloughran/em-hiredis/commit/4b7ec0273790cfe491d686b97894e04297d07c64. Gist not fully tested.
View em-hiredis.rb
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)