Skip to content

Instantly share code, notes, and snippets.

View rahulvramesh's full-sized avatar
💻
#bud

Rahul V Ramesh rahulvramesh

💻
#bud
View GitHub Profile
@benolee
benolee / howto_pow_ubuntu.txt
Created July 1, 2011 03:32
HowTo Ubuntu pow-like setup
$ sudo aptitude install apache2 dnsmasq
$ sudo vim /etc/dnsmasq.conf
# ...
address=/dev/127.0.0.1
listen-address=127.0.0.1
$ sudo vim /etc/dhcp3/dhclient.conf
# uncomment line 20:
@tobob
tobob / description
Last active September 29, 2017 08:51
My unicorn and nginx configuration
My unicorn and nginx configuration
use ln -s and place new_app in 'sites-enabled' folder
usefull commands:
lsof -wni tcp:8080 - get PID of all unicorn processes
kill -9 PID - kill process
nginx -s reload - reload nginx
unicorn_rails -c /home/workspace/new_app/config/unicorn.rb -D - starts unicorn server
@fpg1503
fpg1503 / DragView.swift
Last active January 31, 2020 20:10
Drag and Drop View on macOS
protocol DragViewDelegate {
var acceptedFileExtensions: [String] { get }
func dragView(dragView: DragView, didDragFileWith URL: NSURL)
}
class DragView: NSView {
required init?(coder: NSCoder) {
super.init(coder: coder)
registerForDraggedTypes([NSFilenamesPboardType, NSURLPboardType])
@coryalder
coryalder / blogpost.md
Created August 17, 2011 07:37
Extract html book files from the safari books online iPad app "Safari To Go" using php.

Save books out of Safari Books Online

From http://objectivesea.tumblr.com/post/9033067018/safaribooks

This is hard. I spent way too much time figuring this out, because I was annoyed that a book I bought (Addison-Wesley) was available online for free, except only for 45 days after which payment was required. So I made this hack... probably useful to no one else, but here it is.

Requirements:

  1. iPad.
  2. Safari To Go (the Safari Books Online iPad app).
Tables:
Users(:id, :username, etc.)
Questions(:id, :text)
Answers(:id, :question_id, :text)
UserAnswers(:id, :user_id, :question_id, :answer_id, :importance)
AcceptedAnswers(:id, :user_answer_id, :answer_id)
Relations
Questions <-> Answers: one-to-many
Questions <-> UserAnswers: one-to-many
@josephspurrier
josephspurrier / etc-init.d-hello-world
Last active May 15, 2021 17:14
/etc/init.d Script for Go Application
#!/bin/bash
#
# chkconfig: 35 95 05
# description: Hello world application.
# Run at startup: sudo chkconfig hello-world on
# Load functions from library
. /etc/init.d/functions
@jcubic
jcubic / cert
Last active June 25, 2021 10:30
Upload SSL Certificate to DirectAdmin controlled domains
#!/bin/bash
output=$(mktemp);
sudo certbot certonly --manual --expand --manual-public-ip-logging-ok \
--preferred-challenges http -n \
-d <LIST OF COMMA SEPARATED DOMAINS AND SUBDOMAINS>\
--manual-auth-hook ./cert.py --agree-tos --email <EMAIL ADRESS> 2>&1 | tee $output
grep "Certificate not yet due for renewal" $output > /dev/null || \
@enricobacis
enricobacis / install.sh
Last active August 26, 2021 16:39
openstack installation on CentOS 7
#!/bin/bash
ifconfig
read -p "Enter your external interface: " EXT_INTER
# do not edit after this line
set -x # enable echo
sudo yum install -y epel-release
sudo yum install -y vim git tmux bash-completion net-tools htop psmisc
@jbonney
jbonney / deploy.rb
Created August 17, 2013 15:15
Mina deployment file to setup new host for Rails applications. Creates the folder structure, fill up the database.yml file, create the associated DB and user and set up new Apache virtual host file.
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
# Usually mina focuses on deploying to one host and the deploy options are therefore simple.
# In our case, there is a number of possible servers to deploy to, it is therefore necessary to
# specify the host that we are targeting.
server = ENV['server']
# Since the same host can have multiple applications running in parallel, it is necessary to