Skip to content

Instantly share code, notes, and snippets.

@makevoid
makevoid / geth_mine.js
Last active October 16, 2016 12:43
Geth mining script, run as last argument of geth via `js geth_mine.js` - source: https://gist.github.com/makevoid/5a618d73c4eff110a21c
// fork of mine.js script on embark-framework, this script mines only if there are new transactions in the pool
var eth, config, main, pendingTransactions, startTransactionMining;
eth = web3.eth;
console.log('geth_mine.js: start');
console.log("node infos: " + (JSON.stringify(admin.nodeInfo)));
config = {
threads: 2 // set this to the number of threads you machine can handle, remember to set a low difficulty in your genesis block to mine faster
@MaxenceCauderlier
MaxenceCauderlier / Tpl.php
Created February 12, 2017 15:12
Simple PHP Template Engine
<?php
class Tpl
{
/** @var string Chemin du template */
protected $filepath;
/** @var string Contenu du template */
protected $filecontent;
@danielthiel
danielthiel / SQLAlchemy_cast.py
Last active February 12, 2021 13:06
SQLAlchemy: filter by date for an datetime field(does not work with SQLite, with PostgreSQL it works fine)
from datetime import date
from sqlalchemy import cast, DATE
Match.query.filter(cast(Match.date_time_field, DATE)==date.today()).all()
@mauri870
mauri870 / manjaro-avell-g1513.md
Last active March 2, 2022 02:23
Installation of Manjaro 17 and nvidia/bumblebee drivers on Avell G1513

After a weekend of research, stress and pain I finally figure out how to install manjaro 17 and configure the nvidia/bumblebee drivers on my avell laptop

Here's my notebook specs:

$ inxi -MGCNA

Machine:   Device: laptop System: Avell High Performance product: 1513
           Mobo: N/A model: N/A v: 0.1 UEFI: American Megatrends v: N.1.02 date: 09/28/2016
Battery    BAT0: charge: 44.0 Wh 100.0% condition: 44.0/44.0 Wh (100%)
@synox
synox / install SonarQube on Raspberry Pi
Last active October 4, 2022 12:06
How to install SonarQube on Raspberry PI
SonarQube does currently not support Raspberry PI.
This is a workaround. It compiles a armv6 compatible version of the java-wrapper and configures sonarqube to use it.
(Testet with Raspbian, wheezy, 3.6)
Compile java-wrapper for ARMv6
============================
Download latest version of " wrapper_prerelease_XY.tar" from http://wrapper.tanukisoftware.com/downloads/ (for me 3.5.17 works)
@vgoklani
vgoklani / app.py
Last active December 19, 2022 09:13
Using Flask to output Python data to High Charts
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def index(chartID = 'chart_ID', chart_type = 'bar', chart_height = 350):
chart = {"renderTo": chartID, "type": chart_type, "height": chart_height,}
series = [{"name": 'Label1', "data": [1,2,3]}, {"name": 'Label2', "data": [4, 5, 6]}]
title = {"text": 'My Title'}
@davlgd
davlgd / pi_soc_monitor.py
Created July 30, 2019 07:02
Raspberry Pi SoC monitoring script
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import csv
import time
delay = 2
csv_file = "pi_soc_results.csv"
@richard-flosi
richard-flosi / bottle-cors.py
Created September 26, 2012 16:55
Bottle with Cross-origin resource sharing (CORS)
"""
Example of setting up CORS with Bottle.py.
"""
from bottle import Bottle, request, response, run
app = Bottle()
@app.hook('after_request')
def enable_cors():
"""
@aheckmann
aheckmann / storeImgInMongoWithMongoose.js
Created April 17, 2012 19:14
store/display an image in mongodb using mongoose/express
/**
* Module dependencies
*/
var express = require('express');
var fs = require('fs');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// img path
@niksumeiko
niksumeiko / git.migrate
Last active April 17, 2024 11:47
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.