Skip to content

Instantly share code, notes, and snippets.

Bogdan Kulbida kulbida

Block or report user

Report or block kulbida

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
View gist:4660d0f84df5fbe5c7c15d1c7c92dcb4
# basic pfctl control
# ==
# Related: http://www.OpenBSD.org
# Last update: Tue Dec 28, 2004
# ==
# Note:
# this document is only provided as a basic overview
# for some common pfctl commands and is by no means
# a replacement for the pfctl and pf manual pages.
@kulbida
kulbida / dd-wrt.markdown
Created Feb 4, 2018 — forked from johnantoni/dd-wrt.markdown
DD-WRT on WRT54G + OpenVPN
View dd-wrt.markdown

for a Linksys WRT54G router (v2.0)

  1. download the openvpn firmware version from http://www.dd-wrt.com/dd-wrtv2/down.php?path=downloads%2Fothers%2Feko%2FV24_TNG%2Fsvn13491-snow%2FVINT/
  2. set you static ip to 192.168.1.7 and connect directly to the router via ethernet cable, disconnect internet from the router.
  3. once connected, update the firmware with the one you just downloaded from the link above.
  4. once done, successfully, reboot.
  5. re-connect the internet cable.
  6. 99% of the time it will reboot, though there's a fine chance of bricking the router so if you can get one from a yardsale, cheaper that way.
  7. once booted, navigate browser to 192.168.1.1
  8. login, the username & password could be either root/root root/admin admin/admin admin/password root/password.
@kulbida
kulbida / nginx.conf
Created Sep 6, 2017 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
View capybara_cheat_sheet.md

Navigating

visit('/projects')
visit(post_comments_path(post))

Clicking links and buttons

click_link('id-of-link')
click_link('Link Text')
click_button('Save')
@kulbida
kulbida / .sails-and-passport.md
Created Jan 23, 2016 — forked from RunnerRick/.sails-and-passport.md
How To Integrate Sails and Passport
View .sails-and-passport.md
@kulbida
kulbida / .ackrc
Created Nov 1, 2015
.ackrc for ack2
View .ackrc
--type-set=coffee=.coffee
--type-set=haml=.haml
--type-set=sass=.sass
--type-set=minifiedjs=.min.js
--nocss
--nominifiedjs
--ignore-dir=coverage
--ignore-dir=dragonfly
--ignore-dir=javascripts/lib
View merge.rb
# Merging Scopes
# ==============
# The goal is to join two tables to get all the records where a scope on both
# side of the join is used. I used to do this with a `where()` in which I
# added some sql on the joined table. But, I wanted to use the existing scopes
# from the joining table. Turns out there's a `merge` method on a scope where
# you can merge with another scope without having to chain!
class Car < ActiveRecord::Base
has_and_belongs_to_many :people
View settimeout.js
// if we have
function do() {
// thing that takes 100ms - 2s depending on browser
}
// Instead of:
setInterval(do, 500) // pray it doesn't lock the browser
// Do this:
@kulbida
kulbida / hdd_usage.go
Last active Aug 29, 2015
Monitor disk usage and send notifications emails when it fills up. Script written in Go lang that can be compiled to executable file and run as a demon on the server. It will check the hdd every hour and will send emails with cycle of 1, 2, 4, 8, 16 and 32 hours.
View hdd_usage.go
package main
import (
"syscall"
"os"
"fmt"
"log"
"net/mail"
"encoding/base64"
View db.rake
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
epoch = Time.now.to_i
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}-#{epoch}.dump"
end
You can’t perform that action at this time.