Skip to content

Instantly share code, notes, and snippets.

View yannickcr's full-sized avatar

Yannick Croissant yannickcr

View GitHub Profile
@yannickcr
yannickcr / python.sh
Last active January 4, 2016 05:39 — forked from ryin/tmux_local_install.sh
bash script for installing tmux and python without root access
#!/bin/bash
# Script for installing python on systems where you don't have root access.
# python will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
PYTHON_VERSION=2.7.6
@yannickcr
yannickcr / test.js
Created January 22, 2014 17:44
Outgoing port tester. Test outbound TCP port using portquiz.net. Useful to see which port is blocked by your network.
var
exec = require('child_process').exec,
current = 0,
max = 100
;
function scan (i) {
if (current < max) {
current++;
exec('curl portquiz.net:' + i, callback.bind(this, i));
@yannickcr
yannickcr / highlights_full_line.patch
Created January 6, 2014 14:47
highlights_full_line option for SublimeLinter 3
lint/linter.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lint/linter.py b/lint/linter.py
index bb701df..bef4602 100644
--- a/lint/linter.py
+++ b/lint/linter.py
@@ -1258,13 +1258,17 @@ class Linter(metaclass=LinterMeta):
col = i
break
@yannickcr
yannickcr / emblem-CSS.js
Last active December 28, 2015 12:58
HTML5, JS, CSS3 and MDN emblems for Battlefield 4
emblem.emblem.load({
"objects": [
{
"opacity": 1,
"angle": -5.0043635188,
"flipX": false,
"flipY": false,
"top": 138,
"height": 298.3367253252,
"width": 20,
@yannickcr
yannickcr / set.js
Created June 5, 2013 09:41
Handlebars Set Helper: Capture a block of content and store it in a variable.
/*
* Usages:
* {{#set "content"}}
* captured content
* {{/set}}
* My {{ content }}
*/
Handlebars.registerHelper('set', function(name, options) {
this[name] = options.fn(this);
return null;
@yannickcr
yannickcr / transmission.js
Created January 16, 2013 20:59
Small script to check the actives hosts on the network and, according to the results, start/stop the torrents. NB: The high priority torrents remains untouched.
// Small script to check the actives hosts on the network and, according to the results, start/stop the torrents.
// NB: The high priority torrents remains untouched.
//
// cron task to exec it every 5min: */5 * * * * root node /volume1/web/tasks/transmission/transmission.js > /dev/null
var Transmission = require('transmission'); // node-transmission - https://github.com/FLYBYME/node-transmission
var exec = require('child_process').exec;
// Log in to transmission
var transmission = new Transmission({
[
{ "keys": ["ctrl+m"], "command": "toggle_side_bar" }
]
@yannickcr
yannickcr / social.js
Created February 28, 2012 15:59
Insert GooglePlus and Facebook buttons (use the HTML5 embedding code)
/*
* Google Plus
*
* Include Google Plus One if there is a "g-plusone" button in the page
*
*/
$(document).ready(function() {
if (!$('.g-plusone').length) return;
window.___gcfg = {lang: 'fr-FR'};
@yannickcr
yannickcr / test.js
Created October 25, 2011 12:52
Ack / Grep
var util = require('util');
var exec = require('child_process').exec;
// Grep (ok)
exec("grep 'grep' test.js", function(){
console.dir(arguments);
});
// Ack (nok)
exec("ack 'ack' test.js", function(){
@yannickcr
yannickcr / example.html
Created May 2, 2011 21:27
A simple JS snippet to execute your framework-dependant code when the (asynchronously loaded) framework is ready.
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<title>Example</title>
<script>
// Define an empty array
var Ready = [];
</script>
<script async src="main.js"></script>
<script>