Skip to content

Instantly share code, notes, and snippets.

View SuzanaK's full-sized avatar

Suzana K. SuzanaK

View GitHub Profile
@paucoma
paucoma / gglCalEventsOnSpreadSheet.gs
Last active March 7, 2023 21:42
Script to read Google Calendar Events and Count total Hours
const gblFrom = {
year : 2020 ,
month : 3,
day : 29,
hour : 0
};
const gblTo = {
year : 2020 ,
month : 8,
day : 1,
@ttomsu
ttomsu / JsonSchemaValidationSpec.groovy
Last active July 17, 2018 12:14
Testing out JSON Schema validator
/*
* Copyright 2016 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@svanoort
svanoort / CollectionTest.java
Last active August 11, 2022 14:10
Java Microbenchmarks
package hudson.cli;
import org.junit.Test;
import java.util.*;
// Micro benchmark different array ops in Java
// Originally started from http://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist/7507740#7507740
// Now completely rewritten to correctly warm up the JIT compilation and take an average over many runs
// Tweaked/corrected version from http://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist/7507740#7507740
@olih
olih / jq-cheetsheet.md
Last active June 13, 2024 14:04
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@peterhurford
peterhurford / pytest-fixture-modularization.md
Created July 28, 2016 15:48
How to modularize your py.test fixtures

Using py.test is great and the support for test fixtures is pretty awesome. However, in order to share your fixtures across your entire module, py.test suggests you define all your fixtures within one single conftest.py file. This is impractical if you have a large quantity of fixtures -- for better organization and readibility, you would much rather define your fixtures across multiple, well-named files. But how do you do that? ...No one on the internet seemed to know.

Turns out, however, you can define fixtures in individual files like this:

tests/fixtures/add.py

import pytest

@pytest.fixture
@tommcfarlin
tommcfarlin / get-trello-names.js
Last active July 7, 2021 15:15
[JavaScript] Returns an array of all of the names of a Trello boards members.
/**
* Retrieves a list of all of the members on a Trello board and stores and
* returns their names in an array. It will not include any duplicates.
*
* Trello names are usually represented as "Elliot Alderson (mrrobot)" but the
* returned array will only return an array with their actual name (that is,
* Ellio Alderson).
*
* This does not require jQuery or any third-party library to run. If you want
* to run this from the console of Chrome, then paste this entire function into
@AtulKsol
AtulKsol / psql-error-fix.md
Last active April 10, 2024 07:41
Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:

from

@pbeshai
pbeshai / .block
Last active July 17, 2023 09:40
Animate thousands of points with canvas and D3
license: mit
height: 620
border: no
@pbeshai
pbeshai / .block
Last active January 25, 2019 21:35
Line Circle Illusion
license: mit
height: 540
border: no
@arttuladhar
arttuladhar / GebDemoSpec.groovy
Created June 12, 2017 22:06
REST API Testing Using Spock
package specs
import geb.spock.GebReportingSpec
class GebDemoSpec extends GebReportingSpec {
def "Testing Basic Page Contents"(){
setup:
go "http://localhost:9000/#/demo/geb-demo"