Skip to content

Instantly share code, notes, and snippets.

View vallieres's full-sized avatar
🏡
Working from Home

Alexandre Vallières-Lagacé vallieres

🏡
Working from Home
View GitHub Profile
@vallieres
vallieres / rpi-temp-volt.sh
Created May 16, 2014 14:32
Raspberry Pi - Get Temperature and Voltage
#!/bin/bash
clear
sleep 2
echo
date
echo
echo 'Firmware Version'
/opt/vc/bin/vcgencmd version
echo
tm=`/opt/vc/bin/vcgencmd measure_temp`
@vallieres
vallieres / rpi-temp.sh
Last active August 29, 2015 14:01
Get Chip Temperature for Raspberry Pi
#!/bin/bash
######################################################################
# Raspberry Pi
#
# Gross Script by Vallières (Alexandre Vallières-Lagacé) <alexandre.valliereslagace@gmail.com>
# V1.0 2014-05-16
#
# Use the thermal zone0 to obtain the Temp of the SOC
#
# No dependencies
@vallieres
vallieres / download_compile_bfgminer.sh
Created May 23, 2014 14:28
Get latest bfgminer and compile
git clone https://github.com/luke-jr/bfgminer.git
cd bfgminer
CFLAGS="-O2 -Wall -march=native"
./autogen.sh
./configure --enable-gridseed --enable-scrypt --disable-adl --disable-avalon --disable-bifury --disable-bfx --disable-hashbuster --disable-hashbusterusb --disable-hashfast --disable-bitfury --disable-bigpic --disable-littlefury --disable-nanofury --disable-hashbuster --disable-bitforce --disable-icarus --disable-klondike --disable-knc --disable-modminer --disable-x6500 --disable-ztex
make
@vallieres
vallieres / generate-articles-jekyll.py
Last active November 17, 2015 18:01 — forked from jaden/generate-articles.py
A script that generates 5000 test posts for Hugo benchmarks
# Create specified number of articles for Jekyll benchmarks
from datetime import datetime
import random
import string
from sys import argv
def generateWord():
length = random.randint(1, 10)
word = ''.join(random.choice(string.letters) for _ in range(length))
if( $key != 'aRandomKeyThatMakesItPrivate' ) {
return '404';
}
// The dir where the Git repo will live on your server
$repo_dir = '/home/username/webapps/website_git/';
// Full path to git binary is required if git is not in your PHP user's path. Otherwise just use 'git'.
$git_bin_path = '/usr/bin/git';
@vallieres
vallieres / slugify-slim-framework-endpoint.php
Last active January 27, 2016 18:20
Simple API Endpoint That Uses Cocur/Slugify to Transform the Title of Artilces, , all the details on https://hipsterpixel.co/2016/01/27/my-blog-publishing-workflow-on-ios-part-1-tutorial
require 'vendor/autoload.php';
use Cocur\Slugify\Slugify;
/* This goes inside your API function */
header('Content-Type:text/plain');
$slugify = new Slugify();
echo $slugify->slugify($string);
@vallieres
vallieres / jekyll-post-merge-hook.sh
Last active January 27, 2016 18:19
post-merge Hook Script for Jekyll Auto Build and Rsync. All details available here: https://hipsterpixel.co/2016/01/27/my-blog-publishing-workflow-on-ios-part-1-tutorial
#!/bin/bash
TZ=America/New_York
timestamp="$(date +"%s")"
touch ~/logs/user/jekyll_hp_$timestamp.log
SUBJECT="Hipster Pixel - Jekyll Update ($timestamp)"
EMAIL=" <enter your email here> "
@vallieres
vallieres / keybase.md
Created April 1, 2016 00:41
Keybase Validation

Keybase proof

I hereby claim:

  • I am vallieres on github.
  • I am vallieres (https://keybase.io/vallieres) on keybase.
  • I have a public key whose fingerprint is 6E00 2E5B EA9B 19AC 174E E079 F28A A14A 4A37 AC54

To claim this, I am signing this object:

@vallieres
vallieres / genereate-1000-files-with-content.sh
Last active February 7, 2017 17:00
Generate 1000 files with random characters as content of the length of the index
#!/bin/bash
# Generates 1000 files with name from 1.txt to 1000.txt, each file has a random set of letters and number equivalent to the number its filename.
# For example, 12.txt has a string of 12 chars inside it.
for i in {0001..1000}
do
CONTENT=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w $i | head -n 1)
echo $CONTENT > "file_${i}.txt"
done
@vallieres
vallieres / youtube-not-playlist-script.php
Created May 18, 2017 19:44
List YouTube's Channel Videos Not in a Playlist
<?php
function getSslPage($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);