Skip to content

Instantly share code, notes, and snippets.

@cristovaov
cristovaov / generate_release_log.sh
Created July 9, 2016 15:07
Generates a log file from latest tag and (n) of commits passed
#!/bin/bash -
#title :generate_release_log.sh
#description :generates a log file from latest tag and (n) of commits passed
#author :Cristovao Verstraeten
#date :20160709
#version :20160709
#usage :./generate_release_log.sh
#notes :
#bash_version :4.3.39(3)-release
#============================================================================
@cristovaov
cristovaov / activate
Last active August 12, 2016 22:21
Crude script to activate a Python virtual environment in Git Bash. Probably works w/ MSYS2, not sure on Cygwin -> needs usecases.
# Usage like activating venv on Linux: source /path/to/env/Scripts/activate
# Use 'deactivate_venv' on CL or pass argument '--deactivate' on the source command to deactivate env.
deactivate_venv() {
if [[ -z ${_OLD_VIRTUAL_PATH} ]]; then
printf "No virtual environment found!\n"
else
export PATH=$_OLD_VIRTUAL_PATH
export PS1=$_OLD_VIRTUAL_PS1
unset _OLD_VIRTUAL_PATH
@cristovaov
cristovaov / fetch-followers.py
Created March 4, 2016 10:46
Silly tweepy / python script to get names and followers count on the Twitter
import tweepy
# Keys, tokens and secrets
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
# Tweepy OAuthHandler
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
@cristovaov
cristovaov / search-n-strip.py
Created February 3, 2016 15:05
Search and stripping in a file. My first Python script y'all! I needed this to strip a SQL string,
import os
import sys
def main():
print "\n"
fn = raw_input("Enter name of file: ")
print "Opening file: %s\n" % fn
if not os.path.exists(fn):
print("File does not exist!\n")
@cristovaov
cristovaov / git-it.sh
Last active November 10, 2022 16:55
git-it.sh
#!/bin/bash -
#title :git-it.sh
#description :Self destructing Git initialisation script. Self-destruction now optional!
#author :Cristovao Verstraeten - https://gist.github.com/cristovaov/d9c397016f7d345b157d
#date :20150823
#version :2022.11.10
#usage :./git-it.sh
#notes :Commented the self-destructing bits! Added capitalization to commit messages.
#bash_version :4.3.39(3)-release
#============================================================================
@cristovaov
cristovaov / map-vm.cmd
Last active December 2, 2015 21:33
Lazy way to map a Vagrant virtual machine...
@ECHO off
net use z: "%1" /user:vagrant vagrant
@cristovaov
cristovaov / gist:8691070
Created January 29, 2014 16:00
loop-attachment.php
<?php
/**
* The loop that displays an attachment
*
*/
?>
<?php if ( ! empty( $post->post_parent ) ) : ?>
<p class="page-title"><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="<?php echo esc_attr( sprintf( __( 'Return to %s', 'twentyten' ), strip_tags( get_the_title( $post->post_parent ) ) ) ); ?>" rel="gallery"><?php
/* translators: %s - title of parent post */
@cristovaov
cristovaov / file-name-sanvertwo.php
Created November 27, 2013 11:27
trying to apply patch 22363.8 as a plugin to not mess with wp core files -helps me as well to understand the remove_ process ----do not use as it is not yet functioning -- getting 'fatal error: cannot redeclare...'
<?php
/*
Plugin Name: file name sanitizer
Description: Removes accents at file upload from WP Trac. Patch at http://core.trac.wordpress.org/attachment/ticket/22363/22363.8.patch
Version: 26 10 2013
*/
remove_filter('sanitize_file_name', $filename, $filename_raw);
/**
@cristovaov
cristovaov / simple-sticky-footer_css
Last active December 23, 2015 04:08
Simple bootstrap based sticky footer --just what it says ---see logbook for info/instructions http://wp.me/pKmdR-oo