Skip to content

Instantly share code, notes, and snippets.

@Dreyer
Dreyer / random-string.js
Created April 12, 2012 15:24
Generate random alphanumeric string in JavaScript
// @source: http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript
function randomStr(m) {
var m = m || 9; s = '', r = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (var i=0; i < m; i++) { s += r.charAt(Math.floor(Math.random()*r.length)); }
return s;
};
@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@torgeir
torgeir / audio-source-microphone.js
Created September 19, 2013 17:55
Microphone input as audio source js
window.AudioContext = window.AudioContext || window.webkitAudioContext;
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
window.addEventListener('load', init, false);
function init () {
try {
record(new AudioContext());
}
catch (e) {
@danharper
danharper / background.js
Last active April 16, 2025 06:53
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@aksakalli
aksakalli / SimpleHTTPServer.cs
Last active January 4, 2025 06:04
SimpleHTTPServer in C#
// MIT License - Copyright (c) 2016 Can Güney Aksakalli
// https://aksakalli.github.io/2014/02/24/simple-http-server-with-csparp.html
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.IO;
@ellemenno
ellemenno / spinner.rb
Created March 11, 2014 16:41
ascii spinner
#!/usr/bin/env ruby
# encoding: UTF-8
@dot_cycle = ['⣾','⣽','⣻','⢿','⡿','⣟','⣯','⣷']
#braille random: 0x2800 - 0x28ff
@z_arrow = ['←','↖','↑','↗','→','↘','↓','↙']
@z_b = ['b','ᓂ','q','ᓄ']
@z_d = ['d','ᓇ','p','ᓀ']
@trdlo
trdlo / stickynotes_install.sh
Last active April 21, 2017 21:21
sticky_notes install @ nginx
# http://sayakb.github.io/sticky-notes/pages/install/
# https://github.com/sayakb/sticky-notes
mkdir /var/www/paste && cd /var/www/paste.domain.tld && git clone https://github.com/sayakb/sticky-notes.git .
chown -Rv www-data:www-data /var/www/paste
cp stickynotes_nginx.conf /etc/nginx/sites-enabled/paste.domain.tld
ln -s /etc/nginx/sites-available/paste.domain.tld /etc/nginx/sites-enabled/.
/etc/init.d/nginx reload
cd /var/www/paste.domain.tld/app/config
mv database.sample.php database.php
@morganrallen
morganrallen / _README.md
Last active January 15, 2023 19:41
Janky Browser

JankyBrowser

The only cross-platform browser that fits in a Gist!

One line install. Works on Linux, MacOSX and Windows.

Local Install

$&gt; npm install http://gist.github.com/morganrallen/f07f59802884bcdcad4a/download
@drmalex07
drmalex07 / README-create-debian-startup-script.md
Last active September 15, 2024 02:28
An example of how to create a init.d script in Debian, using dependency booting. #debian #init.d #lsb-script #startup-script