Skip to content

Instantly share code, notes, and snippets.

void swap(int a, int b, int* ref1, int* ref2) {
*ref2 = a;
*ref1 = b;
}
int main() {
int a = 5, b = 10;
swap(a, b, &a, &b);
printf("%d\n%d\n", a,b);
void swap(int a, int b, int* ref1, int* ref2) {
*ref2 = a;
*ref1 = b;
}
int subtract(int a, int b) {
if(b == 0) return a + 1;
return a + subtract(a, b - 1);
}
int add(int a, int b) {
if(b == 0) return a;
return 1 + add(a, b - 1);
}
int subtract(int a, int b) {
if(b == 0) return a;
return subtract(a, b - 1) - 1;
}
int add(int a, int b) {
if(b == 0) return a;
b--;
return 1 + add(a, b);
}
int subtract(int a, int b) {
if(b == 0) return a;
b--;
return subtract(a, b) - 1;
@timothyandrew
timothyandrew / README.md
Last active December 16, 2023 17:05
Set up a seedbox (on DigitalOcean – Ubuntu) really quick

Introduction

  • This script lets you set up and use a temporary DigitalOcean droplet to download torrent files.
  • Once downloaded, they can be streamed down to your local machine.
  • This uses transmission-cli for the torrent client, and nginx to serve files.

Setup on Local Machine

  • This assumes that you have a DigitalOcean account and tugboat set up, as well as seedbox-setup.sh present in the current directory.
x = "Akshay Gupta <kitallis@nilenso.com>, Aninda Kundu <aninda@nilenso.com>, Asif Kalam <asif@nilenso.com>, Jasim <jasim@nilenso.com>, Jithu Gopal <jithu@nilenso.com>, Neha Kumari <neha@nilenso.com>, Nivedita <nid@nilenso.com>, Nivedita Priyadarshini <nid@nilenso.com>, Prashant Karpe <prashant@nilenso.com>, Srihari Sriraman <srihari@nilenso.com>, Srushti Ambekallu <srushti@nilenso.com>, Steven Deobald <steven@nilenso.com>, Tejas Dinkar <tejas@nilenso.com>"
x.scan(/\<([^>]+)\>/).flatten.each do |str|
system "heroku sharing:add -r production #{str}"
end
(ns antonyms.core
(:gen-class)
(:require [clj-http.client :as client]))
(use 'clojure.java.io)
(defn antonym-for
[word]
(let [api-key "8c1e369f560ac4b0acfff71c674b37d6"
server-url (str "http://words.bighugelabs.com/api/2/" api-key "/" word "/json")
(ns antonyms.core
(:gen-class)
(:require [clj-http.client :as client]))
(use 'clojure.java.io)
(defn process-file
"Call func once for with each line in filename"
[filename func]
(with-open [rdr (reader filename)]
@timothyandrew
timothyandrew / pepperplate_export.py
Created August 28, 2018 06:25
Export Pepperplate database to Paprika YAML
import sqlite3
import requests
import yaml
import base64
conn = sqlite3.connect('/path/to/recipes_2.db')
conn.row_factory = sqlite3.Row
c = conn.cursor()
def downloadAsBase64(url):
@timothyandrew
timothyandrew / screenshot.png
Last active February 4, 2019 18:08
Taskpaper Separators
screenshot.png