Skip to content

Instantly share code, notes, and snippets.

@jethrokuan
jethrokuan / agenda_view.el
Created December 20, 2019 07:31
Agenda View
(setq jethro/org-agenda-todo-view
`(" " "Agenda"
((agenda ""
((org-agenda-span 'day)
(org-deadline-warning-days 365)))
(todo "TODO"
((org-agenda-overriding-header "To Refile")
(org-agenda-files '(,(concat jethro/org-agenda-directory "inbox.org")))))
(todo "TODO"
((org-agenda-overriding-header "Emails")
@prathik
prathik / todo.el
Last active September 27, 2020 05:27
Manage daily todo files on Emacs
(defun todo-create-directory (directory)
"Creates the todo directory."
(if (file-exists-p directory) (message "Directory exists")
(make-directory directory)
(message "Directory created")
))
(defun create-todo-file (directory filename)
"Checks if the todo file exists if not creates it."
(todo-create-directory directory)

Thinking about 'meta' torrent file format.

Let's say I've downloaded big file using torrent. Then add very small file and recreate new torrent file. Like subtitle.

Now two torrent files are totally different file to machine. Tracker and torrent client would treat them different torrent. Of course we don't need duplicate original data file for multi seeding. But seeders and leechers split by two torrent file. They don't know about they have exact same file. Torrent client and tracker cannot connect people for exact same data. We have split share pool for exact same file. It's not efficient. More seeders, more speed.

Let's say original torrent file is 1.torrent.

[ file1 ]
@rcoup
rcoup / rsync_parallel.sh
Created April 10, 2013 21:52
Parallel-ise an rsync transfer when you want multiple concurrent transfers happening,
#!/bin/bash
set -e
# Usage:
# rsync_parallel.sh [--parallel=N] [rsync args...]
#
# Options:
# --parallel=N Use N parallel processes for transfer. Defaults to 10.
#
# Notes:
@forkrul
forkrul / Unix tips
Last active December 14, 2015 16:28
Unix tricks
# http://mmb.pcb.ub.es/~carlesfe/unix/tricks.txt
I have marked with a * those which I think are absolutely essential
Items for each section are sorted by oldest to newest. Come back soon for more!
BASH
* In bash, 'ctrl-r' searches your command history as you type
- Add "set -o vi" in your ~/.bashrc to make use the vi keybindings instead
of the Emacs ones. Takes some time to get used to, but it's fantastic!
- Input from the commandline as if it were a file by replacing
'command < file.in' with 'command <<< "some input text"'
@nijikokun
nijikokun / example-user.js
Created May 3, 2012 20:46
Beautiful Validation... Why have I never thought of this before?!
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);
@vickychijwani
vickychijwani / ai-class.py
Created November 12, 2011 10:37 — forked from sumodx/ai-class.py
Download lecture videos of ai-class, with HTTP proxy and basic resume support
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Deepak.G.R."
__credits__ = "Sumod Hajela"
__license__ = 'Public Domain'
"""
usage:
Go to command line and type
@igrigorik
igrigorik / webapp.rb
Created November 13, 2010 21:28
Inspired by @JEG2's talk at Rubyconf... Any ruby object, as a webapp! 'Cause we can. :-)
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
@zhengjia
zhengjia / r3.rb
Created September 24, 2010 04:00 — forked from Lytol/ultemplate.rb
# Rails application template for Rails 3 + Git + haml + JQuery + Rspec + Cucumber + Capybara + FactoryGirl
# by Brian Smith <bsmith@swig505.com>
# Create a default README
remove_file "README"
file "README.md", <<-EOF
#{app_const}
#{"=" * app_const.length}
TODO: description
namespace :doc do
namespace :diagram do
task :models do
sh "railroad -i -l -a -m -M | dot -Tpng | sed 's/font-size:14.00/font-size:12.00/g' > doc/models.png"
end
task :controllers do
sh "railroad -i -l -C | dot -Tpng | sed 's/font-size:14.00/font-size:12.00/g' > doc/controllers.png"
sh "gwenview ./doc/models.png"
end