Skip to content

Instantly share code, notes, and snippets.

josephernest

Block or report user

Report or block josephernest

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@josephernest
josephernest / fulltextsearch.py
Created Oct 14, 2018
Examples of FullTextSearch, spellfix, FullTextSearch+spellfix together, with Python and Sqlite
View fulltextsearch.py
import sqlite3
db = sqlite3.connect(':memory:')
c = db.cursor()
c.execute('CREATE TABLE mytable (description text)')
c.execute('INSERT INTO mytable VALUES ("Riemann")')
c.execute('INSERT INTO mytable VALUES ("All the Carmichael numbers")')
print '1) EQUALITY'
c.execute('SELECT * FROM mytable WHERE description == "Riemann"'); print 'Riemann:', c.fetchall()
@josephernest
josephernest / mklinkgui.py
Last active Sep 3, 2018
mklinkgui - make symbolic links in Windows Explorer with context menu
View mklinkgui.py
import win32clipboard # pip install pywin32 if needed
import sys, os, subprocess
fname = sys.argv[1]
win32clipboard.OpenClipboard()
filenames = win32clipboard.GetClipboardData(win32clipboard.CF_HDROP)
win32clipboard.CloseClipboard()
for filename in filenames:
base = os.path.basename(filename)
link = os.path.join(fname, base)
subprocess.Popen('mklink %s "%s" "%s"' % ('/d' if os.path.isdir(filename) else '', link, filename), shell=True)
@josephernest
josephernest / wave.py
Last active May 13, 2019
wave.py (enhanced)
View wave.py
# wave.py (Enhanced)
# Date: 2018/04/30 Joseph Ernest
#
# URL: https://gist.github.com/josephernest/e3903ba30b820cd199500e50f145a11f
# Source: Lib/wave.py
#
# Added:
# * IEEE support
# * 24 bit support
# * cue + loops markers support
@josephernest
josephernest / eeencode.py
Created Jan 26, 2017
Sublime Text plugin that adds simple encryption/decryption with password. Available with CTRL+SHIFT+P as "Eeencode" and "Dddecode"
View eeencode.py
# Based on http://stackoverflow.com/a/16321853/1422096
# Added a few things to support UTF8.
#
# Install:
# 1) Put the file in C:\Users\***\AppData\Roaming\Sublime Text 2\Packages\User
# 2) Add a reference in C:\Users\***\AppData\Roaming\Sublime Text 2\Packages\User\Default.sublime-commands:
# [{ "caption": "Eeencode", "command": "eeencode" }, { "caption": "Dddecode", "command": "dddecode" }]
import sublime, sublime_plugin
View hamburger_icon.md

Here is a solution, inspired of DenisSheremet's comment and slightly modified.

[![enter image description here][1]][1]

document.getElementById('nav').addEventListener('click', function() { 
    document.getElementById('hello').className = ''; 
@josephernest
josephernest / wavfile.py
Last active Sep 9, 2019
wavfile.py (enhanced)
View wavfile.py
# wavfile.py (Enhanced)
# Date: 20190213_2328 Joseph Ernest
#
# URL: https://gist.github.com/josephernest/3f22c5ed5dabf1815f16efa8fa53d476
# Source: scipy/io/wavfile.py
#
# Added:
# * read: also returns bitrate, cue markers + cue marker labels (sorted), loops, pitch
# See https://web.archive.org/web/20141226210234/http://www.sonicspot.com/guide/wavefiles.html#labl
# * read: 24 bit & 32 bit IEEE files support (inspired from wavio_weckesser.py from Warren Weckesser)
View markdowntemplate.html
<!--
#
# This is a Markdown template. Write in Markdown in the main #content div. Let the result be rendered automatically.
#
# author: Joseph Ernest (twitter: @JosephErnest)
# url: http://github.com/josephernest/
# license: MIT license
-->
<!DOCTYPE html>
@josephernest
josephernest / findduplicateswholedisk.py
Last active Nov 15, 2016
Find duplicates in a whole disk
View findduplicateswholedisk.py
# -*- coding: utf-8 -*-
# DUPLICATES FINDER
# Nov 15, 2016, Joseph Ernest
#
# Required: Python 64 (Reminder: change build system to Python64 in Sublime)
PATH = 'd:\\' # path
N = 10*1024*1024 # find duplicates in files bigger than ... MB
@josephernest
josephernest / daemon.py
Last active Sep 13, 2019
Daemon for Python
View daemon.py
# From "A simple unix/linux daemon in Python" by Sander Marechal
# See http://stackoverflow.com/a/473702/1422096
#
# Modified to add quit() that allows to run some code before closing the daemon
# See http://stackoverflow.com/a/40423758/1422096
#
# Joseph Ernest, 2016/11/12
import sys, os, time, atexit
from signal import signal, SIGTERM
@josephernest
josephernest / samplerbox_maker.sh
Last active Nov 14, 2017
Script to make the SamplerBox ISO Image
View samplerbox_maker.sh
#!/bin/bash -v
# CREATE A RASPBIAN JESSIE IMAGE FOR SAMPLERBOX
# 2016-08-31
#
# USAGE: chmod 777 samplerbox_maker.sh ; nohup sudo ./samplerbox_maker.sh &
set -e
sudo apt-get update && sudo apt-get install -y cdebootstrap kpartx parted sshpass zip
You can’t perform that action at this time.