This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
current_branch=$(git rev-parse --abbrev-ref HEAD) | |
remote="$1" | |
if [ "$current_branch" == "main" ] && [ "$remote" == "origin" ]; then | |
echo "You can not push to $remote from $current_branch" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# drop this file in app/lib/pagination.rb | |
module Pagination | |
DEFAULT_PAGE_LIMIT = 10 | |
def pages(records:, url:) | |
paginate = Paginate.new(records: records, | |
url: url, | |
limit: limit, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nmcli connection import type openvpn file your-connection.ovpn | |
nmcli connection modify your-connection +vpn.data username=your-user-name | |
nmcli connection modify your-connection ipv4.never-default true | |
nmcli connection up your-connection passwd-file passwd-file | |
# To list all VPN connections | |
nmcli connection show --active | grep vpn | |
# To connect to the VPN | |
nmcli connection up your-connection passwd-file passwd-file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
describe Api::V1::CheckoutsController, type: :request do | |
let(:user) do | |
FactoryGirl.create(:user, current_balance: 100_000) | |
end | |
describe 'check concurrency' do | |
it 'send multiple same requests', truncation_only: true do | |
FactoryGirl.create(:item, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nori' | |
single_comment = <<~EOF | |
<?xml version="1.0" encoding="UTF-8"?> | |
<comments> | |
<comment> | |
<description>TEST COMMENT 123</description> | |
</comment> | |
</comments> | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use it with at command | |
# e.g. `reminder "make tea" | at now + 30 minutes` | |
# Also learn how to make atrun work in osx | |
# https://unix.stackexchange.com/questions/478823/making-at-work-on-macos/478840#478840 | |
function reminder(){ | |
echo "reattach-to-user-namespace say $1; reattach-to-user-namespace osascript -e 'tell app \"System Events\" to display dialog \"${1}\" with title \"Reminder ⏰\"'" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nc -v mongo_url 27017 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Text (Text, map, | |
toLower, words, pack) | |
import Data.Text.IO (readFile) | |
import Data.Char (isLetter) | |
import Prelude hiding (map, words, readFile) | |
import Data.Map.Strict (toList, fromListWith) | |
import GHC.Exts (sortWith) | |
import Control.DeepSeq | |
import Control.Parallel.Strategies hiding(parMap) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
typedef vector<int> vi ; | |
typedef vector<vi> vvi; | |
typedef vector<vvi> vvvi; | |
vvvi qs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heroku logs -t -n=10 | awk -F " |=" '/fwd/{system("geocode " $14)}' | grep --line-buffered "Full address\|State" |
NewerOlder