Skip to content

Instantly share code, notes, and snippets.

Nic Nilov nicnilov

Block or report user

Report or block nicnilov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nicnilov
nicnilov / retry.sh
Created Feb 28, 2019 — forked from felipou/retry.sh
Retry command
View retry.sh
#
# Created by Felipe Machado - 2016/02/14
#
# A retry command for bash
# Retries the given command up to MAX_RETRIES, with an interval of SLEEP_TIME
# between each retry. Just put it on your bash_profile and be happy :)
# Usage:
# retry [-s SLEEP_TIME] [-m MAX_RETRIES] COMMAND_WITH_ARGUMENTS
#
# Codes used as reference:
@nicnilov
nicnilov / pgdb2csv.sh
Created Sep 15, 2018
Dump postgresql database to csv
View pgdb2csv.sh
#!/bin/bash
DB_SCHEMA="public"
DB_USER="postgres"
DB_HOST="localhost"
DB_PORT="db_port"
DB_NAME="db_name"
# DB_PASS="" to be passed from shell
psql "postgresql://$DB_USER:$DB_PASS@$DB_HOST:$DB_PORT/$DB_NAME" -Atc "select tablename from pg_tables where schemaname='$DB_SCHEMA'" $DB_NAME |\
View script.sh
pg_ctl -D /usr/local/var/postgresql@9.6 start
pg_ctl -D /usr/local/var/postgresql@9.6 stop
@nicnilov
nicnilov / script.rb
Created Dec 9, 2017
Mailgun console test
View script.rb
mg_client = Mailgun::Client.new('api-key')
message_params = {
from: 'alice@example.com',
to: 'bob@example.com',
subject: 'The Ruby SDK is awesome!',
text: 'It is really easy to send a message!'
}
mg_client.send_message('mg.registered.domain', message_params)
@nicnilov
nicnilov / disable.sh
Created Oct 23, 2017 — forked from pwnsdx/disable.sh
Disable bunch of #$!@ in Sierra (Version 2.1)
View disable.sh
#!/bin/bash
# IMPORTANT: You will need to disable SIP aka Rootless in order to fully execute this script, you can reenable it after.
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
# Agents to disable
TODISABLE=('com.apple.security.keychainsyncingoveridsproxy' 'com.apple.personad' 'com.apple.passd' 'com.apple.screensharing.MessagesAgent' 'com.apple.CommCenter-osx' 'com.apple.Maps.mapspushd' 'com.apple.Maps.pushdaemon' 'com.apple.photoanalysisd' 'com.apple.telephonyutilities.callservicesd' 'com.apple.AirPlayUIAgent' 'com.apple.AirPortBaseStationAgent' 'com.apple.CalendarAgent' 'com.apple.DictationIM' 'com.apple.iCloudUserNotifications' 'com.apple.familycircled' 'com.apple.familycontrols.useragent' 'com.apple.familynotificationd' 'com.apple.gamed' 'com.apple.icloud.findmydeviced.findmydevi
@nicnilov
nicnilov / gist:bc30fd01d9f58fd9dc7e64eb076495ea
Created Jun 1, 2017
Brew revert Postgresql to 9.4 after auto upgrade and use existing data directory
View gist:bc30fd01d9f58fd9dc7e64eb076495ea
brew search postgres
brew uninstall postgresql
brew install postgresql@9.4
brew link postgresql@9.4 --force
pg_ctl -D /usr/local/var/postgres/ start # << specify the existing data directory and not the newly installed one
View keybase.md

Keybase proof

I hereby claim:

  • I am nicnilov on github.
  • I am nicnilov (https://keybase.io/nicnilov) on keybase.
  • I have a public key whose fingerprint is E874 E06B A8E0 4F88 D634 417E 673F BE4F 14A9 B008

To claim this, I am signing this object:

View SQL representation
SELECT "customers".*
FROM (
SELECT "customers".*
FROM "customers"
WHERE "customers"."company_id" = $1
AND (
NOT (
EXISTS (
SELECT "import_logs".*
FROM "import_logs"
You can’t perform that action at this time.