Skip to content

Instantly share code, notes, and snippets.

@jeffcogswell
jeffcogswell / create_C_index.js
Last active Aug 29, 2015
Cloudant Index Creation using node and nano.js
View create_C_index.js
/*
nano doesn't yet have support for Cloudant's new index feature,
but you can still do it using nano's request function.
This code creates an index.
To try this, first replicate the database as per
instructions here:
http://docs.cloudant.com/guides/cloudant-query.html
View query_C_index.js
/*
nano doesn't yet have support for Cloudant's new index feature,
but you can still do it using nano's request function.
This code queries an index.
To try this, first replicate the database as per
instructions here and make sure you created an index.
(Also check out my node.js code to create the index
here:https://gist.github.com/jeffcogswell/1c2f06f5dcd152c055b6)
@jeffcogswell
jeffcogswell / simplefileline.js
Created Dec 7, 2015
Demo of simple way to get file/line in node.js
View simplefileline.js
var path = require('path');
function getfileline(stacklevel) {
var index = stacklevel || 2;
var stacklist = (new Error().stack).split('\n')[index];
// regexps borrowed from "tracer" in npm
var stackReg = /at\s+(.*)\s+\((.*):(\d*):(\d*)\)/gi;
var stackReg2 = /at\s+()(.*):(\d*):(\d*)/gi;
var sp = stackReg.exec(stacklist) || stackReg2.exec(stacklist);
var result = {
func: sp[1],
@jeffcogswell
jeffcogswell / sliderdemo.html
Last active Dec 14, 2015
Basic slider demo
View sliderdemo.html
<!-- Try taking out the overflow:hidden to see more visually how the whole things works -->
<style>
.onramp {
width:500px;
height:500px;
overflow: hidden;
border: 5px solid black;
}
@jeffcogswell
jeffcogswell / resize.md
Created Feb 19, 2016
Resize linux windows via command line
View resize.md

(You may need to install wmctrl via package manager)

List the windows:

wmctrl -l

Resize to, for example, 1280x720 and move to upper-left corner:

wmctrl -r '(first few chars of name)' -e 1,0,0,1280,720

View Preferences.sublime-settings -- User
{
"color_scheme": "Packages/Colorsublime - Themes/GitHubCleanWhite.tmTheme",
"font_face": "Droid Sans Mono",
"font_size": 9,
"ignored_packages":
[
"Vintage"
],
"line_padding_bottom": -1,
"line_padding_top": -1
View jeff1.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>name</key>
<string>Jeff1</string>
View LXDE.desktop
[Desktop Entry]
# This file goes in /usr/share/xsessions
# -rw-r--r-- 1 root root 1507 Feb 27 09:07 LXDE.desktop
# The names/descriptions should really be better
Name=LXDE
Comment=LXDE - Lightweight X11 desktop environment
Comment[ar]=لكسدي - بيئة سطح مكتب X11 خفيفة
Comment[cs]=LXDE - lehké X11 pracovní prostředí
Comment[de]=LXDE - Leichtgewichtige X11 Desktop-Umgebung
Comment[es]=LXDE - Entorno de Escritorio X11 Liviano
@jeffcogswell
jeffcogswell / resetadapter.bat
Created Jul 13, 2016
Reset wifi adapter - Run as administrator
View resetadapter.bat
netsh interface set interface name="Wi-Fi" admin=disabled
timeout 3
netsh interface set interface name="Wi-Fi" admin=enabled
@jeffcogswell
jeffcogswell / themerc
Created Sep 14, 2016
Openbox Theme - modified Clearlooks with slightly more modern border
View themerc
# Name: Clearlooks-Jeff
# Based on Clearlooks by John McKnight <jmcknight@gmail.com>
# Place this in /home/username/.local/share/themes/Clearlooks-Jeff/openbox-3
### Menu
#menu.border.color: #b5aa99
menu.title.bg: Flat Border Gradient Vertical
menu.title.bg.color: #589bda
menu.title.bg.colorTo: #3c7cb7