Skip to content

Instantly share code, notes, and snippets.

View cole-wilson's full-sized avatar
🖖
cole.ws

Cole Wilson cole-wilson

🖖
cole.ws
View GitHub Profile
@fliptopbox
fliptopbox / string.compress.js
Created October 15, 2013 12:32
JavaScript String compression
/*
@fliptopbox
LZW Compression/Decompression for Strings
Implementation of LZW algorithms from:
http://rosettacode.org/wiki/LZW_compression#JavaScript
Usage:
var a = 'a very very long string to be squashed';
var b = a.compress(); // 'a veryāăąlong striċ to bečquashed'
@azadisaryev
azadisaryev / convertExcel2Sheets
Last active March 9, 2024 18:23
Google Apps Script for converting Excel (.xls or .xlsx) file to Google Spreadsheet. Drive API must be enabled in your script's Advanced Google Services and in Developers Console for the script to work (see https://developers.google.com/apps-script/guides/services/advanced#enabling_advanced_services for details).
/**
* Convert Excel file to Sheets
* @param {Blob} excelFile The Excel file blob data; Required
* @param {String} filename File name on uploading drive; Required
* @param {Array} arrParents Array of folder ids to put converted file in; Optional, will default to Drive root folder
* @return {Spreadsheet} Converted Google Spreadsheet instance
**/
function convertExcel2Sheets(excelFile, filename, arrParents) {
var parents = arrParents || []; // check if optional arrParents argument was provided, default to empty array if not
@mandiwise
mandiwise / Count lines in Git repo
Last active June 6, 2024 06:11
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
@mhingston
mhingston / swal-override.js
Created June 11, 2015 10:01
Override native alert, confirm and prompt functions with prettier versions and optional callbacks
/*
Include SweetAlert before this script
http://t4t5.github.io/sweetalert
*/
function alert(message, callback)
{
callback = callback || function(){}
var options =
{
@Zeerg
Zeerg / newcert.py
Last active March 21, 2024 17:22
Python script to generate CSR/Self Signed Cert. Needs pyOpenssl and python-whois
#!/usr/bin/python
from OpenSSL import crypto
import os
import sys
import datetime
import whois
#Variables
TYPE_RSA = crypto.TYPE_RSA
TYPE_DSA = crypto.TYPE_DSA
@alessaba
alessaba / TouchID.py
Last active October 27, 2021 03:53
TouchID.py
# coding: utf-8
from objc_util import *
ObjCClass('NSBundle').bundleWithPath_('/System/Library/Frameworks/LocalAuthentication.framework').load()
context = ObjCClass('LAContext').alloc().init()
policy = 1 #put 1 if you want to auth with password, 2 with passcode
reason = 'We need you fingerprint to ste...ehm... to log you in'
def funct(_cmd,success,error):
if success:
@claymcleod
claymcleod / pycurses.py
Last active June 15, 2024 04:21
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@erdem
erdem / countries.json
Last active May 30, 2024 22:37
Country list as JSON format. fields: name, coordinates, timezones, country code and capital resource: https://github.com/mledoze/countries
[
{
"timezones": [
"America/Aruba"
],
"latlng": [
12.5,
-69.96666666
],
"name": "Aruba",
@fopina
fopina / mic_client.py
Created July 28, 2016 12:24
microphone streaming with pyAudio
#!/usr/bin/env python
import pyaudio
import socket
import sys
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
CHUNK = 4096
http://invisible-island.net/xterm/
XTerm Control Sequences
Edward Moy
University of California, Berkeley
Revised by