Skip to content

Instantly share code, notes, and snippets.

@lambdamusic
lambdamusic / gist-backup.py
Last active July 27, 2023 14:28 — forked from fedir/gist-backup.py
Clone or update all user's gists #gists
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Forked from https://gist.github.com/fedir/5466075
Changes:
- allows to import Github gists into a local DASH database (https://kapeli.com/dash)
- gists are added to any existing snippet already in database
- filetypes are added, but support is very basic
@lambdamusic
lambdamusic / python_request_create_gist.py
Last active April 11, 2021 20:19 — forked from joshisumit/python_request_create_gist.py
Create GIST from your python code with python requests module and OAuth token.
'''
HTTP Reuests has following parameters:
1)Request URL
2)Header Fields
3)Parameter
4)Request body
PREREQUISITE
* head over to https://github.com/settings/tokens and generate a new token with 'gists' permissions
@lambdamusic
lambdamusic / splitter.sh
Created September 24, 2018 19:29 — forked from maesa/splitter.sh
Bash script for splitting large CSV files while keeping the header into 100 lines a piece using Split. Outputs as Part1, Part2, ... while keeping its Header
#!/bin/bash
FILENAME=filename_here.csv
HDR=$(head -1 $FILENAME)
split -l 100 $FILENAME xyz
n=1
for f in xyz*
do
if [ $n -gt 1 ]; then
echo $HDR > Part${n}.csv
fi
# Obtain the label of a given class (:class1).
SELECT DISTINCT ?c (STR(?l) AS ?lb)
WHERE {
?c a :class1 ;
<http://www.w3.org/2000/01/rdf-schema#label> ?l .
}
# Obtain a list of classes.
SELECT DISTINCT ?c
WHERE {
@lambdamusic
lambdamusic / Evolution of a Python programmer.py
Last active October 3, 2016 14:49
Evolution of a Python programmer
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@lambdamusic
lambdamusic / LICENSE.txt
Created March 1, 2016 17:32 — forked from anonymous/LICENSE.txt
Ontology documentation
The MIT License (MIT)
Copyright (c) 2016 OntoSPy project [http://ontospy.readthedocs.org/]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@lambdamusic
lambdamusic / gist:eb4f4079642ff8e160a2
Created January 4, 2016 15:49
TextMate 2 .tm_properties

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.

@lambdamusic
lambdamusic / install-poppler-qt4-xpdf
Created November 20, 2015 18:01 — forked from cczona/install-poppler-qt4-xpdf
brew install -v poppler --with-qt4 --enable-xpdf-headers
$ brew install -v poppler --with-qt4 --enable-xpdf-headers
==> Downloading http://poppler.freedesktop.org/poppler-0.18.2.tar.gz
File already downloaded in /Users/cczona/Library/Caches/Homebrew
/usr/bin/tar xf /Users/cczona/Library/Caches/Homebrew/poppler-0.18.2.tar.gz
Package QtCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `QtCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'QtCore' found
Package QtGui was not found in the pkg-config search path.
Perhaps you should add the directory containing `QtGui.pc'
@lambdamusic
lambdamusic / extractAnnotations.py
Created November 20, 2015 16:51 — forked from stevepowell99/extractAnnotations.py
Extracts annotations and highlighted passages in all .pdf files in a folder recursively and outputs them as text files with the same name and modification date
#!/usr/bin/env python
# see http://socialdatablog.com/extract-pdf-annotations.html
myxkfolder="/home/steve/xk/" #you need to set this to where you want your to-dos to appear
import poppler, os.path, os, time, datetime
for root, dirs, files in os.walk('./'):
for lpath in files:
@lambdamusic
lambdamusic / jsonld.sh
Created October 14, 2015 18:31 — forked from jprante/jsonld.sh
JSON-LD in Elasticsearch
curl -XDELETE 'localhost:9200/jsonld'
curl -XPOST 'localhost:9200/jsonld'
curl -XPUT 'localhost:9200/jsonld/doc/1' -d '
{
"@context":
{
"dc": "http://purl.org/dc/elements/1.1/",