Skip to content

Instantly share code, notes, and snippets.

@rudolfbyker
rudolfbyker / split_wav.py
Created April 25, 2017 10:35
Split WAV files at silence
#!/usr/bin/env python
from scipy.io import wavfile
import os
import numpy as np
import argparse
from tqdm import tqdm
# Utility functions
@mesgarpour
mesgarpour / appsScript_ListFilesFolders_ver.2.js
Last active April 22, 2024 01:35
[Google Apps Script] List all files & folders in a Google Drive folder, & write into a speadsheet
/*
* Copyright 2017 Mohsen Mesgarpour
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@methane
methane / bench.py
Last active April 20, 2024 00:03
Benchmarking MySQL drivers (Python 3.4)
from __future__ import print_function
import time
def query_10k(cur):
t = time.time()
for _ in range(10000):
cur.execute("SELECT 1,2,3,4,5")
res = cur.fetchall()
assert len(res) == 1
assert res[0] == (1,2,3,4,5)
@DakuTree
DakuTree / decryptchromecookies.py
Last active April 3, 2024 19:22
Decrypt Chrome Cookies File (Python 3) - Windows
#Based off https://gist.github.com/DakuTree/98c8362fb424351b803e & pieces of https://gist.github.com/jordan-wright/5770442
from os import getenv
from shutil import copyfile
import sqlite3
import win32crypt #https://sourceforge.net/projects/pywin32/
# Copy Cookies to current folder
copyfile(getenv("APPDATA") + "/../Local/Google/Chrome/User Data/Default/Cookies", './Cookies')
# Connect to the Database
anonymous
anonymous / SQLyogTunnel.php
Created May 23, 2010 00:50
<?php
/*
SQLyog
Copyright 2003-2006, Webyog
http://www.webyog.com
HTTP Tunneling Page
This page exposes the MySQL API as a set of web-services which is consumed by SQLyog - the most popular GUI to MySQL.
@ka7eh
ka7eh / leaflet_to_pdf.html
Created April 12, 2016 16:55
An example for converting Leaflet maps to PDF using leaflet-image and jsPDF
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css"/>
<style>
#mapid{
height: 480px;
}
#download {
position:absolute;
@trafficinc
trafficinc / dbbackup.py
Last active March 8, 2024 04:26
Python script for taking mysqldump
#!/usr/local/bin/python3
"""
Will backup all the databases listed, will put files in same DIR as script'
To run: $ python dbbackup.py OR python3 dbbackup.py
"""
import configparser
import os
import time
@bmcbride
bmcbride / postgis_geojson.php
Created February 26, 2012 05:43
PHP PostGIS to GeoJSON
<?php
/**
* PostGIS to GeoJSON
* Query a PostGIS table or view and return the results in GeoJSON format, suitable for use in OpenLayers, Leaflet, etc.
*
* @param string $geotable The PostGIS layer name *REQUIRED*
* @param string $geomfield The PostGIS geometry field *REQUIRED*
* @param string $srid The SRID of the returned GeoJSON *OPTIONAL (If omitted, EPSG: 4326 will be used)*
* @param string $fields Fields to be returned *OPTIONAL (If omitted, all fields will be returned)* NOTE- Uppercase field names should be wrapped in double quotes
* @param string $parameters SQL WHERE clause parameters *OPTIONAL*
@crofty
crofty / leaflet-google.js
Created March 25, 2012 15:07
Leaflet plugin that enables the use of Google Map tiles - http://matchingnotes.com/using-google-map-tiles-with-leaflet
/*
* L.TileLayer is used for standard xyz-numbered tile layers.
*/
L.Google = L.Class.extend({
includes: L.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
@sspecht
sspecht / Portable Postgres Install
Last active March 2, 2024 17:26
Portable Postgres / PostGIS Install for Windows
Eine kurze Dokumentation, wie man Postgres/Postgis unter Windows ohne Installation betreibt:
- PG-Binaries (ZIP) herunterladen und entpacken
http://www.enterprisedb.com/products-services-training/pgbindownload
- Batch-Datei lt. Anhang bzw. lt.
http://www.postgresonline.com/journal/archives/172-Starting-PostgreSQL-in-windows-without-install.html
im Haupt-Verzeichnis speichern (das Verzeichnis, in dem /bin zu finden ist).
- Beim ERSTEN Start der run.bat muss die gekennzeichnete Zeile ausgeführt, danach aber wieder auskommentiert werden.