Skip to content

Instantly share code, notes, and snippets.

@dsouzajude
dsouzajude / postgres-dump-and-import-schema-without-indexes.sh
Last active October 17, 2024 13:06
Dump and import schema without indexes
# Read more about pg_dump, pre-data, post-data sections and the Fc flags at:
# https://www.postgresql.org/docs/13/app-pgdump.html
# -- Dump operations from Source Database --------------------------------------------
# Dumps the schema but excludes all the constraints and indexes (i.e pre-data section)
pg_dump -h $SOURCE_ENDPOINT --section=pre-data -U postgres -d $DB_NAME --file=schema-pre-data.dump.sql
# Dump the schema for the indices and constraints as well as we will need it later
# to apply it to the tables after the destination database is in sync.
@markhorrocks
markhorrocks / test_google_sheets_apiV4.rb
Last active July 23, 2024 14:34
Editing Google Sheets with the Google::Apis::SheetsV4 Ruby Client
#! /usr/bin/ruby
require 'google/apis/sheets_v4'
require 'googleauth'
require 'googleauth/stores/file_token_store'
require 'fileutils'
OOB_URI = 'urn:ietf:wg:oauth:2.0:oob'
APPLICATION_NAME = 'Google Sheets API Test'
# -*- coding: utf-8 -*-
import scrapy
from scrapy.http.request import Request
from scrapy.selector import Selector
import urllib2
import re
import PyV8
import json
@Bouke
Bouke / gist:11261620
Last active August 3, 2023 01:46
Multiple Python installations on OS X

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10

$ pyenv install 2.6.9

@bsa7
bsa7 / 1. config\deploy.rb
Last active August 29, 2015 13:56
Worked recipe at 2014.03.09 - Rails 4.0.3 + Ruby 2.1.0 + puma 2.8.0 + capistrano 2.15.5 + nginx 1.4.4
# $:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Для работы rvm
require 'rvm'
require 'rvm/capistrano'
require 'bundler/capistrano'
require 'puma/capistrano'
set :application, "myapp"
set :rails_env, "production"
ssh_options[:port] = 777
set :port, 777
#! /usr/bin/env python3
'''pyCookieCheat.py
2015022 Now its own GitHub repo, and in PyPi.
- For most recent version: https://github.com/n8henrie/pycookiecheat
- This gist unlikely to be maintained further for that reason.
20150221 v2.0.1: Now should find cookies for base domain and all subs.
20140518 v2.0: Now works with Chrome's new encrypted cookies.
See relevant post at http://n8h.me/HufI1w
#############################################################################
# current prompt
#############################################################################
# \d – Current date
# \t – Current time
# \h – Host name
# \# – Command number
# \u – User name
# \W – Current working directory (ie: Desktop/)
# \w – Current working directory, full path (ie: /Users/Admin/Desktop)
@kenrett
kenrett / Selenium Cheat Sheet.md
Last active July 31, 2024 20:56
Selenium Cheat Sheet - Ruby

#Getting Started

##Webpage:

<html>
<head>
    <title>Testing with Ruby and Selenium WebDriver</title>
</head>
 
<body bgcolor="antiquewhite">
@julionc
julionc / 00.howto_install_phantomjs.md
Last active November 6, 2024 15:45
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@runlevel5
runlevel5 / puma.sh
Last active July 18, 2022 17:37
pumactl is very broken, @nemshilov and @joneslee85 wrote this bash script replacement and it works so reliably on production server. So here it is, share with the world!
#!/usr/bin/env bash
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`.
# Please modify the CONSTANT variables to fit your configurations.
# The script will start with config set by $PUMA_CONFIG_FILE by default
PUMA_CONFIG_FILE=config/puma.rb
PUMA_PID_FILE=tmp/pids/puma.pid
PUMA_SOCKET=tmp/sockets/puma.sock