Skip to content

Instantly share code, notes, and snippets.

View hakonhagland's full-sized avatar

Håkon Hægland hakonhagland

  • NORCE Research
  • Norway, Bergen
View GitHub Profile
@hakonhagland
hakonhagland / setup-oauth2.md
Last active April 24, 2017 19:42
Generating and downloading client secrets for oauth2 for an installed application using Google API console

Setting up OAuth 2.0 (Installed Applications)

To use OAuth 2.0 in your installed application, you need an OAuth 2.0 client ID, which your application uses when requesting an OAuth 2.0 access token. See https://developers.google.com/api-client-library/python/auth/installed-app for more information.

To create an OAuth 2.0 client ID in the console, go to the API Console.

@hakonhagland
hakonhagland / github-fork-sync-upstream.md
Last active May 5, 2017 12:43
How to sync a local github fork with upstream?

Fork the repository from the GitHub UI

First fork the repository using the GitHub UI. This will create a copy of the repository under your GitHub account.

On your local machine

Run (some of) the following commands:

git clone https://github.com/my-user-name/name-of-repo.git
git remote add upstream https://github.com/orig-author-user-name/name-of-repo.git
git checkout master

git fetch upstream

This was tested on a macOS High Sierra version 10.13.4

I already had XCode installed. First, we need a C compiler to install perlbrew. I had upgraded my mac so I needed to agree to the licence once more:

sudo xcodebuild -license

Now the C compiler should be working. Then I installed perlbrew:

curl -L https://install.perlbrew.pl | bash

After having installed google chrome on Ubuntu 18.04, I had an issue when opening chrome for the first time after login. There was an annoying dialog window asking me to enter a password to unlock the login keyring. Probably there was a good security reason for this? Maybe it was because I had set Ubuntu not to ask for a password when I log in? Anyway, this gist explains how I got rid of this dialog.

  • First, click "Show Applications" icon on the desktop screen, from there select the "Password and keys" icon.
  • In the "passwords and keys" window, right click "Login" in the left column and choose "Unlock" if the keyring is locked.
  • Type in your login password to unlock the keyring
  • Then again, right click "Login" in the "Password and login" window and choose "Delete" to delete the login keyring.
  • Then close the "Passwords and keys" window
@hakonhagland
hakonhagland / install_gnu_gsl.md
Last active October 10, 2018 19:12
Install Gnu GSL library on Ubuntu

Download the tar file:

sudo apt-get install make
cd $HOME
mkdir -p gsl
cd gsl
wget http://gnuftp.uib.no/gsl/gsl-latest.tar.gz
tar zxvf gsl-latest.tar.gz
rm gsl-latest.tar.gz
@hakonhagland
hakonhagland / oauth-pm.patch
Created July 16, 2019 21:51
Fix syntax errors in OAuth.pm
diff --git a/OAuth.pm b/OAuth.pm
index 5985f5d..d15b367 100644
--- a/OAuth.pm
+++ b/OAuth.pm
@@ -193,7 +193,7 @@ the object back to the state it was in when constructed.
sub resetTokens {
my $this = shift;
- for my $key qw(request_token request_token_secret access_token access_token_secret)
+ for my $key (qw(request_token request_token_secret access_token access_token_secret))
@hakonhagland
hakonhagland / kvm-copy-paste.md
Last active April 18, 2024 16:11
How to make copy&paste work between Ubuntu host and Windows 10 guest for a KVM virtual machine?
@hakonhagland
hakonhagland / grep-hash.pl
Last active April 7, 2021 16:50
Grep array of hash refs
my @items;
for my $ref (@whole) {
my $key = $ref->{name};
push @items, $key if !exists $props{$key};
}
@hakonhagland
hakonhagland / log.txt
Created July 2, 2021 19:31
Building amazon-kinesis-video-streams-producer-sdk-cpp on Windows 10
This file has been truncated, but you can view the full file.
-- Kinesis Video Cpp Producer path is C:/test/akvspsc
-- dependencies install path is C:/test/akvspsc/open-source
-- Begin building dependencies.
-- Configuring done
-- Generating done
-- Build files have been written to: C:/test/akvspsc/open-source/liblog4cplus
Scanning dependencies of target project_log4cplus
[ 11%] Creating directories for 'project_log4cplus'
[ 22%] Performing download step (git clone) for 'project_log4cplus'
Cloning into 'project_log4cplus'...