Skip to content

Instantly share code, notes, and snippets.

View connors511's full-sized avatar

Matthias Larsen connors511

  • Gentofte, Denmark
View GitHub Profile
@connors511
connors511 / gist:55d5794cd1bd21487c4c2a1f394f466b
Created May 14, 2017 13:41
Auto suspend & wake-up script
#!/bin/bash
# Auto suspend and wake-up script
#
# Puts the computer on standby and automatically wakes it up at specified time
#
# Written by Romke van der Meulen <[email protected]>
# Minor mods fossfreedom for AskUbuntu
#
# Takes a 24hour time HH:MM as its argument
python setup.py build_ext --inplace
running build_ext
skipping 'dbscan.cpp' Cython extension (up-to-date)
python -m cProfile -s time test.py
('SIZE: ', 699795)
[ 0 6 13 ..., 699783 699789 699795]
[11759 29187 47008 ..., 86047 89930 98188]
('Clusters: ', 65)
('Largest cluster: ', 2)
('Cluster size: ', 66501)
python setup.py build_ext --inplace --cython-cplus
running build_ext
skipping 'dbscan.cpp' Cython extension (up-to-date)
time python test.py
('SIZE: ', 1422)
[ 0 14 31 41 54 70 83 99 112 125 140 150 163 177 193
206 221 238 252 266 280 295 312 325 339 351 363 378 391 405
419 436 451 468 485 496 506 523 537 548 566 583 594 610 625
639 655 672 687 702 716 733 748 764 781 795 811 826 840 854
866 878 895 906 916 929 941 957 972 985 1000 1018 1032 1047 1059
python setup.py build_ext --inplace
running build_ext
skipping 'dbscan.cpp' Cython extension (up-to-date)
python -m cProfile -s time test.py
('SIZE: ', 699795)
[ 0 6 13 ..., 699783 699789 699795]
[11759 29187 47008 ..., 86047 89930 98188]
('Clusters: ', 65)
('Largest cluster: ', 2)
('Cluster size: ', 66501)
// Global scope, for static list after first boot
books = [];
var findBooks = function(db, callback) {
var cursor = db.collection('books').find();
cursor.each(function(err, doc) {
assert.equal(err, null);
if (doc !== null) {
books.push(doc);
} else {
callback();
@connors511
connors511 / 0_reuse_code.js
Last active August 29, 2015 14:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
def isDVDFile(self, file_name):
if list(set(file_name.lower().split(os.path.sep)) & set(['video_ts', 'audio_ts'])):
return True
for needle in ['vts_', 'video_ts', 'audio_ts', 'bdmv', 'certificate']:
if needle in file_name.lower():
return True
@connors511
connors511 / club.js
Last active December 20, 2015 22:19
module.exports = function() {
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var _schema = new Schema({
name: { type: String, trim: true, required: true },
kitchen: { type: Schema.ObjectId, ref: 'Kitchen' },
users: [{
user: { type: Schema.ObjectId, ref: 'User' },
\begin{figure}[htbp]
\centering
\begin{tikzpicture}[x=0.1cm,y=0.1cm]
\def\xmin{0}
\def\xmax{1024000}
\def\ymin{0}
\def\ymax{200}
% grid
<div id="modal-questionare" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="modal-questionare-label" aria-hidden="true" data-backdrop="static">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="modal-questionare-label">Vi har lige et par spørgsmål!</h3>
</div>
<div class="modal-body">
<p>Nu har du haft muligheden for at spille vores spil, og som tak vil vi give dig muligheden for at være med til at bestemme hvordan spillet skal udvikle sig</p>
<p>Alt du skal gøre for at være med til at bestemme, er at svare på spørgsmålene nedenfor.</p>
<p></p>
<form>