Skip to content

Instantly share code, notes, and snippets.

🏡
Working from Home

Alexandre Vallières-Lagacé vallieres

🏡
Working from Home
View GitHub Profile
@vallieres
vallieres / copy-branch-from-jira.js
Created Jan 25, 2019
Copy branch name from JIRA webpage to clipboard
View copy-branch-from-jira.js
javascript:(function(){ const jiraIssueElm = document.querySelector('.issue-link'); const jiraIssue = jiraIssueElm.textContent; const jiraTicketNameElm = document.querySelector('#summary-val'); let jiraTicketName = jiraTicketNameElm.textContent; jiraTicketName = jiraTicketName.toLowerCase(); jiraTicketName = jiraTicketName.split(' ').join('-'); const branchName = jiraIssue '/' jiraTicketName; const copyToClipboard = str => { const el = document.createElement('textarea'); el.value = str; el.setAttribute('readonly', ''); el.style.position = 'absolute'; el.style.left = '-9999px'; document.body.appendChild(el); const selected = document.getSelection().rangeCount > 0 ? document.getSelection().getRangeAt(0) : false; el.select(); document.execCommand('copy'); document.body.removeChild(el); if (selected) { document.getSelection().removeAllRanges(); document.getSelection().addRange(selected); } }; copyToClipboard(branchName); }())
@vallieres
vallieres / toggle-github-pr-files.js
Created Jan 17, 2019
Toggles GitHub's PR Files Collapsable Boxes
View toggle-github-pr-files.js
javascript: void((function(d) {
d.querySelectorAll('button[aria-label="Toggle diff contents"]').forEach(function(x) {
x.click()
});
})(document));
@vallieres
vallieres / bookmarklet-github-pr-status.js
Created Jan 17, 2019
Prepares a Status Update from Selected PR in Github
View bookmarklet-github-pr-status.js
javascript: void((function(d) {
function collectionHas(a, b) { //helper function (see below)
for(var i = 0, len = a.length; i < len; i ++) {
if(a[i] == b) return true;
}
return false;
}
function findParentBySelector(elm, selector) {
var all = document.querySelectorAll(selector);
@vallieres
vallieres / ffmpeg-install.sh
Created Feb 20, 2018
ffmpeg install with all options
View ffmpeg-install.sh
brew install ffmpeg --with-chromaprint --with-fdk-aac --with-fontconfig --with-freetype --with-frei0r --with-game-music-emu --with-libass --with-libbluray --with-libbs2b --with-libcaca --with-libgsm --with-libmodplug --with-librsvg --with-libsoxr --with-libssh --with-libvidstab --with-libvorbis --with-libvpx --with-opencore-amr --with-openh264 --with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-rubberband --with-sdl2 --with-snappy --with-speex --with-tesseract --with-theora --with-tools --with-two-lame --with-wavpack --with-webp --with-x265 --with-xz --with-zeromq --with-zimg
@vallieres
vallieres / youtube-not-playlist-script.php
Created May 18, 2017
List YouTube's Channel Videos Not in a Playlist
View youtube-not-playlist-script.php
<?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);
@vallieres
vallieres / genereate-1000-files-with-content.sh
Last active Feb 7, 2017
Generate 1000 files with random characters as content of the length of the index
View genereate-1000-files-with-content.sh
#!/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 / keybase.md
Created Apr 1, 2016
Keybase Validation
View keybase.md

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 / jekyll-post-merge-hook.sh
Last active Jan 27, 2016
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
View jekyll-post-merge-hook.sh
#!/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 / slugify-slim-framework-endpoint.php
Last active Jan 27, 2016
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
View slugify-slim-framework-endpoint.php
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);
View bitbucket-webhook-script.php
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';
You can’t perform that action at this time.