Skip to content

Instantly share code, notes, and snippets.

@jaseemabid
jaseemabid / sync.py
Created October 23, 2016 11:07
A simple script to get the top 100 songs from Clementine DB and copy it to my phone.
#!/usr/bin/python
'''
A simple script to get the top 100 songs from Clementine DB and copy it to
my phone.
TODO:
1. Handle phone unmount properly. MTPFS suck!
2. Dont copy files already there
3. Delete old files?

Keybase proof

I hereby claim:

  • I am jaseemabid on github.
  • I am jaseemabid (https://keybase.io/jaseemabid) on keybase.
  • I have a public key whose fingerprint is 0D01 F83F 9C88 2B6F 42B0 B93B FE8B A47C AF68 AB61

To claim this, I am signing this object:

@jaseemabid
jaseemabid / emacs.org
Created March 3, 2016 20:03
Setup Emacs dev env for Erlang

Setup with Emacs Development environment with EDTS, Flycheck and use-package

This tutorial assumes a reasonably new version of Emacs (24.4+)

EDTS

Erlang Development Tool Suite aims to provide common IDE like functionality.

Use-package

@jaseemabid
jaseemabid / ttlist.erl
Created March 1, 2016 11:07
Tain truncated list with some basic tests.
%% Simple tail truncated list
-module(ttlist).
-export([new/0, new/1, insert/2, lci/1]).
-export([test/0]).
new() -> [].
new(L)
when is_list(L) ->
@jaseemabid
jaseemabid / lisp.org
Last active February 29, 2016 18:42
Slides of the talk "A micro manual for LISP - Not the whole truth"

Hello!

I’m Jaseem Abid

2009 - ‘13 Batch @jaseemabid gh/jaseemabid

A micro manual for LISP - Not the whole truth

@jaseemabid
jaseemabid / prof.erl
Created February 19, 2016 11:04
Run the MFA, but log the time taken for it as well.
%% @doc Run the MFA, but log the time taken for it as well.
prof(M, F, A) ->
Note = atom_to_list(M) ++ ":" ++ atom_to_list(F),
prof(Note, M, F, A).
prof(Note, M, F, A) ->
S = os:timestamp(),
Result = apply(M, F, A),
E = os:timestamp(),
Diff = timer:now_diff(E, S)/1.0e6,
@jaseemabid
jaseemabid / time.hs
Created October 30, 2015 13:43
Get current time as an integer
-- Definitely not the best way to get current time as integer
currentPosixTime <- (getCurrentTime >>= return . utcTimeToPOSIXSeconds)
let currentTime = (round (read (init $ show(currentPosixTime)) :: Float) :: Integer)
import logging
import time
logger = logging.getLogger(__name__)
def useful():
logger.debug('Hello from webapplib!')
time.sleep(0.01)
;;; auto-remove.el --- Auto remove unused functions in python
;;; Commentary:
;; Uses external tool autoflake to remove unused imports from a Python file.
;;; Code:
(defcustom python-autoflake-path (executable-find "autoflake")
"Autoflake executable path.
@jaseemabid
jaseemabid / gist:8819059
Last active August 29, 2015 13:56
= How the web works, an introduction with Python Flask
= How the web works, an introduction with Python Flask
= Objective
Introduce the audience to web programming, with a clean focus on fundamentals.
Rather than deal with the nuances of a library or a framework, the workshop will
focus on fundamentals like HTTP, simple tools like curl, quick sneak peek into
REST etc
= Description