Skip to content

Instantly share code, notes, and snippets.

View kulbida's full-sized avatar
🎯
Focusing

Bogdan Kulbida kulbida

🎯
Focusing
View GitHub Profile
# 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 February 4, 2018 22:05 — forked from johnantoni/dd-wrt.markdown
DD-WRT on WRT54G + OpenVPN

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 September 6, 2017 19:43 — 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/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@kulbida
kulbida / capybara_cheat_sheet.md
Last active May 18, 2016 19:38 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet

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 January 23, 2016 16:53 — forked from RunnerRick/.sails-and-passport.md
How To Integrate Sails and Passport
@kulbida
kulbida / .ackrc
Created November 1, 2015 02:14
.ackrc for ack2
--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
@kulbida
kulbida / merge.rb
Last active August 29, 2015 14:16 — forked from ngauthier/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
// 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 August 29, 2015 14:12
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.
package main
import (
"syscall"
"os"
"fmt"
"log"
"net/mail"
"encoding/base64"
@kulbida
kulbida / db.rake
Last active August 29, 2015 14:11 — forked from asciant/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