Skip to content

Instantly share code, notes, and snippets.

View astrauka's full-sized avatar

Karolis Astrauka astrauka

  • Vilnius, Lithuania
View GitHub Profile
@astrauka
astrauka / sublime_default_exec.py
Created April 26, 2016 11:02
Sublime default exec command
import sublime, sublime_plugin
import os, sys
import threading
import subprocess
import functools
import time
import collections
class ProcessListener(object):
def on_data(self, proc, data):
# assumming path to nginx is /etc/nginx/
sudo su
cd /etx/nginx
mkdir certs_localhost
cd certs_localhost
# generate self signed certificate, the identifier for it should be localhost
openssl req -x509 -newkey rsa:2048 -keyout development.key -out development.crt -days 5000 -nodes
cd ..
@astrauka
astrauka / ipsec_verify.log
Created May 13, 2014 14:42
Ipsec verify log on setting up l2tp vpn connection
Checking your system to see if IPsec got installed and started correctly:
Version check and ipsec on-path [OK]
Linux Openswan U2.6.37/K(no kernel code presently loaded)
Checking for IPsec support in kernel [FAILED]
SAref kernel support [N/A]
Checking that pluto is running [OK]
Pluto listening for IKE on udp 500 [FAILED]
Pluto listening for NAT-T on udp 4500 [FAILED]
Checking for 'ip' command [OK]
Checking /bin/sh is not /bin/dash [WARNING]
@astrauka
astrauka / clone_rackspace_cloud_files.rb
Last active December 30, 2015 21:59
Ruby on Rails - clone Rackspace cloud files from one container to another. Supports different rackspace users. Add the file contents to app/tasks/clone_rackspace_cloud_files.rb and launch CloneRackspaceCloudFiles.new.run via console. Can use as non-rails script, but then need to make sure require "fog" finds the file required. Environment variab…
require "fog"
require "net/http"
class CloneRackspaceCloudFiles
def service
@service ||= Fog::Storage.new({
:provider => 'Rackspace',
:rackspace_username => ENV["RACKSPACE_USER_NAME"],
:rackspace_api_key => ENV["RACKSPACE_API"],
:rackspace_auth_url => Fog::Rackspace::UK_AUTH_ENDPOINT,
# Discovered a cool mongoid feature for autobuilding embedded or references relations:
class Person
include Mongoid::Document
embeds_one :name, autobuild: true
has_one :address, autobuild: true
end
> Person.new.name # returns a new name object, yey