Skip to content

Instantly share code, notes, and snippets.

View shilovk's full-sized avatar

Kᴏɴsᴛᴀɴᴛɪɴ Sʜɪʟᴏᴠ shilovk

View GitHub Profile
@shilovk
shilovk / openconnect.md
Created September 13, 2022 19:16 — forked from moklett/openconnect.md
OpenConnect VPN on Mac OS X

Unfortunately, the Cisco AnyConnect client for Mac conflicts with Pow. And by "conflicts", I mean it causes a grey-screen-of-death kernel panic anytime you connect to the VPN and Pow is installed.

As an alternative, there is OpenConnect, a command-line client for Cisco's AnyConnect SSL VPN.

Here's how to get it set up on Mac OS X:

  1. OpenConnect can be installed via homebrew:

     brew update
    

brew install openconnect

@shilovk
shilovk / example.md
Last active July 18, 2022 20:41 — forked from sdnts/example.md
Postman pm.sendRequest example

To send a request via the sandbox, you can use pm.sendRequest.

pm.test("Status code is 200", function () {
    pm.sendRequest('https://postman-echo.com/get', function (err, res) {
        pm.expect(err).to.not.be.ok;
        pm.expect(res).to.have.property('code', 200);
        pm.expect(res).to.have.property('status', 'OK');
    });
});
@shilovk
shilovk / ffmpeg-install.sh
Created December 21, 2021 15:35 — forked from clayton/ffmpeg-install.sh
Install FFMPEG on OS X with HomeBrew to convert Mp4 to WebM
# Installation
brew install ffmpeg --with-vpx --with-vorbis --with-libvorbis --with-vpx --with-vorbis --with-theora --with-libogg --with-libvorbis --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus --with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame --with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl --with-libopus --with-libschroedinger --with-libspeex --with-libtheora --with-libvo-aacenc --with-libvorbis --with-libvpx --with-libx264 --with-libxvid
# Easy Peasy
ffmpeg -i video.mp4 video.webm
@shilovk
shilovk / decider.rb
Created October 20, 2021 16:20 — forked from TimothyClayton/decider.rb
RSpec easy loop testing
# frozen_string_literal: true
class Decider
def self.undecided
loop do
break if decision?
end
end
def self.decision?
# code yielding true or false
@shilovk
shilovk / psql_drop_tables_by_user.sh
Last active July 12, 2021 09:17 — forked from dsci/drop.sh
Dropping tables in a PostgreSQL database by table owner
# first, login with psql
psql -U user_name -W -d database_name -h ip_address
# set output for all queries
\o file_name.sql
# run this query
select 'drop table if exist "'|| tablename ||'" cascade;' from pg_tables where tableowner='user_name' and schemaname='public';
# logout from psql
@shilovk
shilovk / curl.md
Created June 9, 2021 17:34 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

Setup

Replace IRB with Pry (in your Gemfile) and Byebug with pry-byebug.

gem 'pry-rails', group: [:development, :test]
gem 'pry-byebug', group: [:development, :test]

Using PRY

@shilovk
shilovk / BootstrapToRails6.md
Created April 10, 2021 13:12 — forked from nachozt/BootstrapToRails6.md
Bootstrap to Rails 6 with webpacker

Step 1:

Add bootstrap and its dependencies:

yarn add bootstrap jquery popper.js

Step 2:

in config/webpack/environment.js add the following:

@shilovk
shilovk / rspec_model_testing_template.rb
Created August 31, 2020 11:38 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@shilovk
shilovk / rails_generator_cheat_sheet.md
Created August 15, 2020 16:45 — forked from cdesch/rails_generator_cheat_sheet.md
Rails Generator CheatSheet

Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.

Command Line Generator Info

Reference

You can get all of this information on the command line.

rails generate with no generator name will output a list of all available generators and some information about global options. rails generate GENERATOR --help will list the options that can be passed to the specified generator.