This file contains hidden or 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
wget -m -p -E -k www.example.com |
This file contains hidden or 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 re | |
import webbrowser | |
text = """ | |
Text with urls goes here. Let's open Google at https://google.com | |
""" | |
urls = re.findall('https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+', text) | |
for url in urls: |
This file contains hidden or 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 random | |
import math | |
inner = 0 | |
total = 0 | |
for i in range(10000): | |
x = random.random() | |
y = random.random() | |
if (math.sqrt(x**2 + y**2) < 1): |
This file contains hidden or 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
var neo4jd3 = new Neo4jd3('#neo4jd3', { | |
onNodeClick: function(node) { | |
if (node.id == 5) { // your node id | |
$.ajax({ | |
url: "/endpoint", // your API endpoint | |
dataType: 'json', // if you receive a JSON | |
success: function(data) { | |
neo4jd3.updateWithNeo4jData(data); | |
} | |
}); |
This file contains hidden or 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
/* Constants */ | |
var URL_EDT = 'http://edt.telecom-bretagne.eu/xxx'; /* Student's iCal source (EDT) */ | |
var GCAL_ID = '[email protected]'; /* Google Calendar ID */ | |
/* ---Helpers--- */ | |
/* Custom object to handle events between EDT and GCal */ | |
function CustomEvent(title, startTime, endTime, description, location) { | |
this.title = title; | |
this.startTime = startTime; | |
this.endTime = endTime; |
This file contains hidden or 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
# sets the proxy cache path location, max size 512m | |
proxy_cache_path /var/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=512m; | |
# transfers the `Host` header to the backend | |
proxy_set_header Host $host; | |
# uses the defined STATIC cache zone | |
proxy_cache STATIC; | |
# cache 200 10 minutes, 404 1 minute, others status codes not cached |
This file contains hidden or 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
/* Based on: http://stackoverflow.com/a/8381494 */ | |
/* Date proptotype extension */ | |
Date.prototype.getWeek = function() { | |
/* I get the current date and then shift it */ | |
var today = new Date(this.setHours(0, 0, 0, 0)); /* Current date */ | |
var dayOfWeek = today.getDay() - 1; /* It starts on Monday (Sunday by default) */ | |
var dayOfMonth = today.getDate() - dayOfWeek; /* ([1-31]) Beginning of the week */ | |
/* Get range */ | |
var start = new Date(today.setDate(dayOfMonth)); /* Monday */ |
This file contains hidden or 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
function replaceCommasDots() { | |
var id = ''; /* Your spreadsheet id (value after /id/*): https://docs.google.com/spreadsheets/d/:id/edit */ | |
var sheet = SpreadsheetApp.openById(id); | |
var range = sheet.getRange("A1:B2"); /* range you want to modify */ | |
var data = range.getValues(); | |
for (var row = 0; row < data.length; row++) { | |
for (var col = 0; col < data[row].length; col++) { | |
data[row][col] = (data[row][col]).toString().replace(/,/g, '.'); | |
} |
This file contains hidden or 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
/* Run: $ casperjs example.js */ | |
var casper = require('casper').create({ | |
verbose: true, /* Production mode: false */ | |
logLevel: 'debug', | |
pageSettings: { | |
loadImages: false, | |
loadPlugins: false | |
} | |
}); |
NewerOlder