Skip to content

Instantly share code, notes, and snippets.

@lambdamusic
lambdamusic / python_request_create_gist.py
Last active Apr 11, 2021 — forked from joshisumit/python_request_create_gist.py
Create GIST from your python code with python requests module and OAuth token.
View python_request_create_gist.py
'''
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 Sep 24, 2018 — 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
View splitter.sh
#!/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
View SPARQL queries to obtain statistics.
# 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 / gist-backup.py
Last active Aug 24, 2019 — forked from fedir/gist-backup.py
Clone or update all user's gists #backup #github #gists #management
View gist-backup.py
#!/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 / LICENSE.txt
Created Mar 1, 2016 — forked from anonymous/LICENSE.txt
Ontology documentation
View LICENSE.txt
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 Jan 4, 2016 — forked from dvessel/gist:1478685
TextMate 2 .tm_properties
View gist:eb4f4079642ff8e160a2

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 Nov 20, 2015 — forked from cczona/install-poppler-qt4-xpdf
brew install -v poppler --with-qt4 --enable-xpdf-headers
View install-poppler-qt4-xpdf
$ 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 Nov 20, 2015 — 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
View extractAnnotations.py
#!/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 Oct 14, 2015 — forked from jprante/jsonld.sh
JSON-LD in Elasticsearch
View jsonld.sh
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/",
@lambdamusic
lambdamusic / Evolution of a Python programmer.py
Last active Oct 3, 2016
Evolution of a Python programmer
View Evolution of a Python programmer.py
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal