This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Throw this in your background script, it injects a generated webpack chunk when asked | |
chrome.runtime.onMessage.addListener(function ({ type, data}, sender, sendResponse) { | |
if (type === 'requestFileInjection') { | |
const file = data.fileName | |
if (!file) throw new Error('No file name provided.') | |
chrome.tabs.executeScript({ file: `${file}.js` }, (result) => { | |
console.log(`${file}.js injected`) | |
return sendResponse({ type: 'injected', target: { src: `${file}.js` }, success: true }) | |
}) | |
return true // return true so sendResponse stays valid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils | |
import ( | |
"crypto/rand" | |
"errors" | |
"math/big" | |
prand "math/rand" | |
"time" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT id, keyword, item_id, item_type, created_by, EXTRACT, extract_start, extract_end, SUM(occurrences/(SELECT keyword_count FROM keyword_counts WHERE item_id = t.item_id AND created_by = [creator user id goes here] AND item_type = t.item_type) * LOG((SELECT COUNT(1) FROM search_results)/(1+(SELECT COUNT(1) FROM search_results WHERE '.[keyword 'OR' statements go here].')))) AS keyword_density_product FROM (SELECT * FROM search_results WHERE ('.[keyword 'OR' statements go here].') AND created_by = [creator user id goes here] AND item_type = [item type, e.g. 'document', goes here]) t GROUP BY item_id ORDER BY keyword_density_product DESC LIMIT [pagination LIMIT goes here] OFFSET [pagination OFFSET goes here]; | |
http://snipplr.com/view/51513/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. stop mysql | |
sudo /etc/init.d/mysql stop | |
2. restart sphinx search | |
kill searched | |
sudo searchd /etc/sphinx/searchd.conf | |
3. start mongodb | |
sudo mongod --config /etc/mongodb/r0.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2011-07-25 | |
# | |
# Mac OS X 10.7 | |
# Xcode 4.1 | |
# Install Lion. | |
# Xcode | |
# Download Xcode from Mac App Store. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import curses | |
import time | |
class Direction(object): | |
NORTH=0 | |
EAST=1 | |
SOUTH=2 | |
WEST=3 | |
class Position(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# How To Create a client certificate | |
#As Root | |
cd /etc/ssl/myca | |
echo "Enter your username/tag!" | |
read USERNAME | |
echo "creating a CSR" | |
openssl req -config openssl.my.cnf -new -nodes -keyout private/${USERNAME}.key -out csr/${USERNAME}.csr -days 365 | |
echo "Sign the CSR, get a Certificate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Module import | |
*/ | |
var express = require('express'); | |
/** | |
* Port the server listens on | |
*/ | |
var port = 3000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# using rvm with ruby-1.8.7-p249 | |
# latest version 2.7.7 2010-06-17 | |
brew install libxml2 | |
# installing libxslt from source code | |
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz | |
tar xvfz libxslt-1.1.26.tar.gz | |
cd libxslt-1.1.26 | |
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configuration Options for MongoDB | |
# | |
# For More Information, Consider: | |
# - Configuration Parameters: http://www.mongodb.org/display/DOCS/Command+Line+Parameters | |
# - File Based Configuration: http://www.mongodb.org/display/DOCS/File+Based+Configuration | |
dbpath = /opt/mongo/data | |
logpath = /opt/mongo/logs/mongodb.log | |
logappend = true |
NewerOlder