Skip to content

Instantly share code, notes, and snippets.

@peterhurford
peterhurford / git-101-exercises.md
Last active July 29, 2023 04:30
Git 101, with Exercises

Git 101, with Exercises

Git is the key tool we use to allow multiple people to work on the same code base. Git takes care of merging everyone's contributions smoothly. Hence, learning how to use Git is critical to contributing to open source.

Exercises

Exercise 1: Go through the Try Git Guide

Exercise 2: Learn How to file a github issue.

@talwrii
talwrii / jqcheatsheet.md
Last active December 16, 2020 15:13
jq cheatsheet

jq cheatsheet

Extract field from list of objects

jq 'map(.foo)'

[ { foo: 1 }, { foo: 2 } ]
[1, 2]
@maggit
maggit / suma_digitos.md
Last active March 1, 2023 01:41
Suma los digitos!

#Suma los digitos! Este archivo de texto tiene un montón de números, el reto es sumar todos los numeros!!!

Ejemplo (si el archivo solo tuviera los siguientes numeros):

  159375
  924
 621
@FilipLukac
FilipLukac / install_pgsql.sh
Last active November 10, 2015 20:12
Install pgsql + pdo_pgsql for Mac OS X El Capitan
PHP_VER="5.6.1"
PHP_INI="/usr/local/php5/lib/php.ini"
# Check if extension exists first
php -m | grep pgsql
# Update brew and install requirements
brew update
brew install autoconf
@vsouza
vsouza / .bashrc
Last active April 9, 2024 05:27
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@pkuczynski
pkuczynski / parse_yaml.sh
Last active April 9, 2024 18:36
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
@gwixted
gwixted / gist:4039676
Created November 8, 2012 15:55 — forked from NickTomlin/Recipes.md
Terminal Cheatsheet

Note

This contains commands shamelessly stolen from many authors. I will try to list all of them at the end of the file, but if I've missed someone, let me know.

Legend

  • UC/Use Case : a practical/frequently used example of the command in action (I find it easier to add commands into my daily workflow if I have an example that uses them in something I often do)

The Prompt


Navigating / Manipulating Text (emacs style terminal) [3]

@mhawksey
mhawksey / gist:1442370
Last active February 25, 2024 12:01
Google Apps Script to read JSON and write to sheet
function getJSON(aUrl,sheetname) {
//var sheetname = "test";
//var aUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=286bbb1d8d30f65b54173b3b752fa4d9&_render=json";
var response = UrlFetchApp.fetch(aUrl); // get feed
var dataAll = JSON.parse(response.getContentText()); //
var data = dataAll.value.items;
for (i in data){
data[i].pubDate = new Date(data[i].pubDate);
data[i].start = data[i].pubDate;
}
@schakko
schakko / ad_ldif_to_xml_json.php
Created March 31, 2011 16:02
Converts Active Directory LDIF schema to XML or JSON
<?php
/**
* This hack converts an Active Directory LDIF schema file to XML or JSON.
* Export Active Directory schema with the following command (must be run as Domain Administrator):
* ldifde -f SaveSchema.ldif -d CN=Schema,CN=Configuration,DC=domain,DC=local
* Change var $file to location of generated schema, open your browser, point to this file and append ?xml for XML output or ?json for JSON output
*
* @author Christopher Klein <ckl[at]ecw[dot]de>
* @url http://wap.ecw.de
*/