Skip to content

Instantly share code, notes, and snippets.

View pascencio's full-sized avatar
💭
Work in progress

Patricio Ascencio Aravena pascencio

💭
Work in progress
  • Santiago, Santiago Metropolitan, Chile
View GitHub Profile
@gfrison
gfrison / groovy-date-time-operations
Created February 5, 2011 15:00
How to add months, days, years to a date in Groovy
Groovy also has a Time Category class which gives you DSL style syntax for manipulating dates. Here is an example:
import org.codehaus.groovy.runtime.TimeCategory
now = new Date()
println now
use(TimeCategory) {
footballPractice = now + 1.week - 4.days + 2.hours - 3.seconds
}
println footballPractice
which will produce output like this:
@inancsevinc
inancsevinc / nginx_subfilter_config
Created June 18, 2012 21:07
configuration example of HttpSubModule, replaces "__name__" in the response
server {
listen 80;
server_name localhost;
root D:/Development/public;
sub_filter_once off;
location / {
if ($uri ~* /(\w+)\.html$) {
set $filename "$1";
@Na0mir
Na0mir / GetSPWebProperties.js
Last active December 13, 2017 16:38
Get SPWeb properties (property bag) using Javascript.
// ----------------------------------------------
// Author: Romain Blanchard
// Date: 20.02.2014
// Description: Get SPWeb properties (property bag) using Javascript.
// ----------------------------------------------
//Execute le script au chargement de la page, juste après le sp.js
ExecuteOrDelayUntilScriptLoaded(getAllWebProperty, "SP.js");
var properties;
@a-h
a-h / 11-weblogic.rb
Created June 11, 2015 14:38
WebLogic Logstash Filter
filter {
## WebLogic Server Http Access Log
if [type] == "weblogic-access" {
grok {
match => [ "message", "%{IP:client} - - \[(?<timestamp>%{MONTHDAY}[./-]%{MONTH}[./-]%{YEAR}:%{TIME}\s+%{ISO8601_TIMEZONE})] \"%{WORD:verb} %{URIPATHPARAM:uri}\s+HTTP.+?\" %{NUMBER:status} %{NUMBER:response_time}" ]
}
date {
match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
}
}
@rponte
rponte / get-latest-tag-on-git.sh
Last active May 16, 2024 06:48
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
@elleryq
elleryq / docker-compose.yml
Last active April 11, 2018 15:06
docker + node-exporter + prometheus + promdash
# Need to do the following steps:
# 1. create /var/prometheus first.
# 2. run: docker-compose run promdash ./bin/rake db:migrate
nodeexporter:
image: prom/node-exporter
ports:
- "9100:9100"
prometheus:
image: prom/prometheus
@lykmapipo
lykmapipo / ChromeExtensionGulp.js
Created December 29, 2015 18:04 — forked from TravelingTechGuy/ChromeExtensionGulp.js
Gulp file for building a Chrome Extension
'use strict';
//npm install gulp gulp-minify-css gulp-uglify gulp-clean gulp-cleanhtml gulp-jshint gulp-strip-debug gulp-zip --save-dev
var gulp = require('gulp'),
clean = require('gulp-clean'),
cleanhtml = require('gulp-cleanhtml'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
stripdebug = require('gulp-strip-debug'),
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active June 11, 2024 19:48
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@juanbrujo
juanbrujo / comunas-regiones.json
Last active June 3, 2024 16:31 — forked from sergiohidalgo/comunas-regiones-chile.json
Comunas y regiones de chile JSON
{
"regiones": [
{
"region": "Arica y Parinacota",
"comunas": ["Arica", "Camarones", "Putre", "General Lagos"]
},
{
"region": "Tarapacá",
"comunas": ["Iquique", "Alto Hospicio", "Pozo Almonte", "Camiña", "Colchane", "Huara", "Pica"]
},
@peterforgacs
peterforgacs / Windows10AWSEC2.md
Last active May 29, 2024 06:50
Running Windows 10 on AWS EC2

Running Windows 10 on AWS EC2

Downloading the image

Download the windows image you want.

AWS vmimport supported versions: Microsoft Windows 10 (Professional, Enterprise, Education) (US English) (64-bit only)

So Home wont work.