Skip to content

Instantly share code, notes, and snippets.

View scriptmaster's full-sized avatar
💭
git commit -am “… ai generated comment here …”

ScriptMaster scriptmaster

💭
git commit -am “… ai generated comment here …”
View GitHub Profile
@scriptmaster
scriptmaster / others-words-deleted.md
Last active October 14, 2020 12:35
repos=125, secret-gists=66, negative-gists-by-others=deleting.md
Bad words written by others in gists: 1 found, 1 deleted

Secret gists       = 66
Forked gists       = deleting / ignored
Total repos worked = 125
Number of bad words written by scriptmaster = 0
Number of bad words others had written and seen in scriptmaster's group of gists: check-your-facts-in-detail
#!/usr/bin/env python
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
import os
import pyaudio
import wave
import audioop
from collections import deque
import time
@scriptmaster
scriptmaster / README.md
Created May 9, 2018 19:22
Maintain (per environment) config.json and load before your Angular components and services load

For modern Angular projects (version 2+), you need to maintain a config.json file per every environment: dev, staging or production.

If you normally import or require this file in your environment.ts file(s) it would be merged as part of your bundle and may not be editable by admins who need to edit them in new clusters.

@scriptmaster
scriptmaster / nodejs-fibers-or-native-node-modules-install-problem-update-gcc
Created February 16, 2018 13:44
nodejs-fibers-or-native-node-modules-install-problem-update-gcc
sudo apt-get install python-software-properties -y
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y
sudo apt-get install build-essential -y
sudo apt-get install gcc-4.8 g++-4.8 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
export CC=gcc
@scriptmaster
scriptmaster / couchdb filters design document
Created February 10, 2018 02:22
couchdb filters design document
{
"_id": "_design/filters",
"_rev": "10-82eb7646e9ac6bc442fbf9ec383dfc3e",
"filters": {
"type": "function (doc, req) { return doc.type === req.query.type; }",
"prop": "function (doc, req) { return doc[req.query.prop] === req.query.value; }",
"name": "function (doc, req) { return doc.name && typeof(req.query.name)!='undefined'? doc.name.toLowerCase() == req.query.name.toLowerCase(): false }"
},
"language": "javascript",
@scriptmaster
scriptmaster / Simple Module Loading for browsers using webpack.config.js
Created February 7, 2018 19:11
Simple Module Loading for browsers using webpack.config.js
var glob = require("glob");
module.exports = {
watch: true,
entry: {
manage: glob.sync('./src/**/index.js')
},
output: {
filename: '[name].bundle.js',
path: __dirname + '/www/js/'
@scriptmaster
scriptmaster / <?php MSheriff_WP_List_Table
Created November 23, 2017 02:19
<?php MSheriff_WP_List_Table
<?php
if( ! class_exists( 'WP_List_Table' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
class MSheriff_WP_List_Table extends WP_List_Table {
function get_columns() {
<input />
<div id="d1" tabindex="0">div</div>
<input />
@scriptmaster
scriptmaster / KeystoneApiExample.md
Last active November 7, 2017 23:01 — forked from JedWatson/KeystoneApiExample.md
Example of how to scaffold API endpoints for Posts in a Keystone project (based on the yo keystone example).

This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.

It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)

Gists don't let you specify full paths, so in the project structure the files would be:

routes-index.js        -->    /routes/index.js         // modified to add the api endpoints
routes-api-posts.js    -->    /routes/api/posts.js     // new file containing the Post API route controllers
@scriptmaster
scriptmaster / vunits.js
Created November 7, 2017 06:19 — forked from LeaVerou/vunits.js
Static polyfill for vw, vh, vm units
/**
* Polyfill for the vw, vh, vm units
* Requires StyleFix from -prefix-free http://leaverou.github.com/prefixfree/
* @author Lea Verou
*/
(function() {
if(!window.StyleFix) {
return;