Skip to content

Instantly share code, notes, and snippets.

View smola's full-sized avatar

Santiago M. Mola smola

View GitHub Profile
@rodionmoiseev
rodionmoiseev / gist:2484934
Created April 25, 2012 00:41
Setting up Play 2.0 in build.gradle
apply plugin: 'java'
apply plugin: 'scala'
// For those using Eclipse or IntelliJ IDEA
apply plugin: 'eclipse'
apply plugin: 'idea'
def findPlay20(){
def pathEnvName = ['PATH', 'Path'].find{ System.getenv()[it] != null }
for(path in System.getenv()[pathEnvName].split(File.pathSeparator)){
for(playExec in ['play.bat', 'play.sh', 'play']){
@bhang
bhang / install_graphite_statsd_ubuntu_precise.sh
Created May 15, 2012 17:41
Install Graphite and statsd on Ubuntu 12.04 LTS (Precise Pangolin)
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git
@andsens
andsens / bootstrap_homeshick.sh
Last active December 27, 2023 12:47
Script that can set up an entire user account with homeshick automatically
#!/bin/bash -ex
# Paste this into ssh
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex
# When forking, you can get the URL from the raw (<>) button.
### Set some command variables depending on whether we are root or not ###
# This assumes you use a debian derivate, replace with yum, pacman etc.
aptget='sudo apt-get'
chsh='sudo chsh'
@bcambel
bcambel / scrapy_download_middleware_canonical_links.py
Created December 23, 2012 18:50
A downloader middleware automatically to redirect pages containing a rel=canonical in their contents to the canonical url (if the page itself is not the canonical one),
@tacone
tacone / gist:4534615
Last active December 11, 2015 02:58
How to manage structured data with Bootstrap typeahead.
/* bad indentation is NetBeans' fault, camelCase is Propel's fault */
var retrieveTeachers = function(query, process) {
// let them be json
var transformTeachers = function(teachers) {
return $.map(teachers, function(teacher) {
return {
id: teacher.Id,
FullName: (teacher.Name + ' ' + teacher.Surname),
// these functions allows Bootstrap typehead to use this item in places where it was expecting a string
toString: function() {
@smola
smola / star_all_the_repos.py
Last active May 5, 2017 07:13
STAR ALL THE REPOS!
#!/usr/bin/python
#
# Stars all the repos for an organization.
#
import sys
import urllib2
import json
import os.path
@miketoth
miketoth / hipchat-giphy
Last active December 7, 2017 20:50 — forked from snit-ram/hipchat-giphy
Giphy on hipchat (no integration needed)
(function () {
function giphy(word, callback) {
var xhr = new XMLHttpRequest();
var url = 'https://api.giphy.com/v1/gifs/translate?rating=pg-13&api_key=dc6zaTOxFJmzC&s=' + encodeURIComponent(word);
xhr.open('GET', url);
xhr.onreadystatechange = function(e) {
if(xhr.readyState === 4) {
var url = JSON.parse(e.target.responseText).data.images.fixed_height.url;
callback(url);
}
@iocanel
iocanel / jenkins-keygen.sh
Created September 1, 2015 09:05
Jenkins key generation
#Generate master.key and secret
MAGIC="::::MAGIC::::"
mkdir -p /var/jenkins_home/secrets
openssl rand -hex 128 > /var/jenkins_home/secrets/master.key
openssl dgst -sha256 -binary /var/jenkins_home/secrets/master.key > /tmp/master.hashed
HEX_MASTER_KEY=`head -c 16 /tmp/master.hashed | xxd -l 16 -p`
openssl rand 259 > /tmp/base
echo $MAGIC >> /tmp/base
openssl enc -aes-128-ecb -in /tmp/base -K $HEX_MASTER_KEY -out /var/jenkins_home/secrets/hudson.util.Secret
@marbu
marbu / xprofile.md
Created September 13, 2015 17:40
searching for xprofile

xprofile file

Raw notes about ~/.xprofile script.

Upstream

Upstream DM which executes ~/.xprofile file in Xsession script:

  • GDM (Gnome): see Xsession.in
  • KDM (KDE 4): see genkdmconf.c
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
colors = true