Skip to content

Instantly share code, notes, and snippets.

View evandrocoan's full-sized avatar
💤
Sleeping...

evandrocoan

💤
Sleeping...
View GitHub Profile
@evandrocoan
evandrocoan / Makefile
Created April 28, 2017 15:04 — forked from prwhite/Makefile
Add a help target to a Makefile that will allow all targets to be self documenting
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing
#!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2010 Riverbank Computing Limited.
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
@evandrocoan
evandrocoan / last_commit.py
Last active June 27, 2019 13:30 — forked from bitrut/last_commit.py
Get timestamp of the last commit in git repository
#!/usr/bin/python
import subprocess
import shlex
import re
from optparse import OptionParser
def git_version(repository_path):
commad = shlex.split( "git log -1 --pretty=format:%ci" )
p = subprocess.Popen(commad, stdout=subprocess.PIPE, cwd=repository_path)
"""
Convert Color Scheme.
Licensed under MIT.
Copyright (C) 2017 Isaac Muse <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
@evandrocoan
evandrocoan / get-latest-tag-on-git.sh
Created December 4, 2017 19:12 — forked from rponte/get-latest-tag-on-git.sh
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@evandrocoan
evandrocoan / canonical.php
Last active April 24, 2022 23:35 — forked from lazysod/canonical.php
Generate a canonical URL using PHP
<?php
$url = "http://domainname.com{$_SERVER['SCRIPT_NAME']}";
echo "<link rel='canonical' href=$url>";
?>
@evandrocoan
evandrocoan / sample24.js
Last active April 24, 2022 23:35 — forked from zlatkov/sample24.js
Fixed single quote misspelling
// `rp` is a request-promise function.
rp('https://api.example.com/endpoint1').then(function(data) {
// …
});
@evandrocoan
evandrocoan / soundPlayingTest.java
Created April 19, 2020 02:41 — forked from andreidbr/soundPlayingTest.java
A Selenium test to check if a sound is playing / has played
@Test(testName = "Listen for Sound", description = "Check that, when clicking the 'A' key, a sound is played", groups = {"01Drums"})
public void soundPlayTest() throws InterruptedException {
driver.findElement(By.xpath("/html/body/div[2]/div[1]")).click();
WebElement aKey = driver.findElement(By.xpath("/html/body/div/div[1]"));
Actions builder = new Actions(driver);
Action sendAKey = builder.moveToElement(aKey).sendKeys("A").build();
sendAKey.perform();
Thread.sleep(1000);
WebElement audio = driver.findElement(By.tagName("audio"));
@evandrocoan
evandrocoan / gist:6d5bfc59b87df1f146204c36a2723f09
Created September 15, 2020 22:39 — forked from samhocevar/gist:00eec26d9e9988d080ac
Configure sshd on MSYS2 and run it as a Windows service
#!/bin/sh
#
# msys2-sshd-setup.sh — configure sshd on MSYS2 and run it as a Windows service
#
# Please report issues and/or improvements to Sam Hocevar <[email protected]>
#
# Prerequisites:
# — MSYS2 itself: http://sourceforge.net/projects/msys2/
# — admin tools: pacman -S openssh cygrunsrv mingw-w64-x86_64-editrights
#
@evandrocoan
evandrocoan / gist:7b2686324501b3da88efe0f11b0d906d
Created September 15, 2020 22:39 — forked from samhocevar/gist:00eec26d9e9988d080ac
Configure sshd on MSYS2 and run it as a Windows service
#!/bin/sh
#
# msys2-sshd-setup.sh — configure sshd on MSYS2 and run it as a Windows service
#
# Please report issues and/or improvements to Sam Hocevar <[email protected]>
#
# Prerequisites:
# — MSYS2 itself: http://sourceforge.net/projects/msys2/
# — admin tools: pacman -S openssh cygrunsrv mingw-w64-x86_64-editrights
#