Skip to content

Instantly share code, notes, and snippets.

View sinameraji's full-sized avatar

Sina Meraji sinameraji

View GitHub Profile
@leon-sleepinglion
leon-sleepinglion / compound_interest_calculator.py
Created March 16, 2018 14:39
Coding for Economist Minds - Week 1
#-------------------------------------------------------------------
# This is a compound interest calculator, along with some challenge
# Written by Leon Wee, March 2018.
# Anyone may freely copy or modify this program.
#-------------------------------------------------------------------
# C = P[(1+r)^n - 1]
# Where:
# C = the compound interest
# P = the principal investment amount (the initial deposit or loan amount)
@spacemonkey
spacemonkey / .gitignore
Created July 11, 2014 10:39
.gitignore for Hexo powered websites
.DS_Store
Thumbs.db
db.json
debug.log
node_modules/
public/
.deploy/
themes/
@ken47
ken47 / gist:3870213
Created October 11, 2012 04:41
single-layer perceptron in Octave / Matlab
function perceptron0 = perceptron(numPoints, runs)
iters = 0;
for i = 1:runs
errors = 2;
points = genPoints(numPoints);
gWeights = [0 0 0];
[fWeights,a,b] = genTarget;
while errors > 0
errors = 0;
@ebraminio
ebraminio / maktabkhooneh.js
Last active April 5, 2021 07:53
maktabkhooneh
// https://maktabkhooneh.org/course/%D9%85%D8%A8%D8%A7%D9%86%DB%8C-%D8%A7%D9%82%D8%AA%D8%B5%D8%A7%D8%AF-mk170/
[...document.querySelectorAll('a.chapter__unit')]
.map(x => () => fetch(x.href)
.then(x => x.text())
.then(x => new DOMParser().parseFromString(x, 'text/html').querySelector('meta[property="og:video"]').content)
.then(y => console.log(y, x.children[1].innerText.trim().replace(/\s/g, '_') + '.mp4'))
)
.reduce((promise, next) => promise.then(next), Promise.resolve())
.then(() => console.log('Finished!'));
@et0and
et0and / worker.js
Created July 14, 2020 09:02
Cloudflare Worker to map custom domain onto a Notion page
const MY_DOMAIN = 'example.com';
/*
* Enter your Notion URL slug to page ID mapping
*/
const SLUG_TO_PAGE = {
'': '771ef38657244c27b9389734a9cbff44',
};
const PAGE_TITLE = '';
@dandrews
dandrews / AngelList Markets
Created April 11, 2013 19:48
All AngelList Markets tags, sorted alphabetically. Scraped from https://angel.co/markets on 4/11/2013.
Accounting
Active Lifestyle
Ad Targeting
Adult
Advanced Materials
Adventure Travel
Advertising
Advertising Exchanges
Advertising Networks
Advertising Platforms
@aheinze
aheinze / gist:02db57da725cf7ba4047
Last active October 30, 2022 07:30
letterAvatar - create Letter avatar based on name initials
/*
* LetterAvatar
*
* Create Letter avatar based on Initials -
* based on https://gist.github.com/leecrossley/6027780
*/
(function(w, d){
function LetterAvatar (name, size) {
@cspickert
cspickert / GoogleSpreadsheets.py
Created January 20, 2012 23:40
Export a Google Spreadsheet using python.
#!/usr/bin/python
import re, urllib, urllib2
class Spreadsheet(object):
def __init__(self, key):
super(Spreadsheet, self).__init__()
self.key = key
class Client(object):

Install cask that extends the brew command :

brew install phinze/cask/brew-cask

Install calibre using cask :

brew cask install calibre