Skip to content

Instantly share code, notes, and snippets.

@ryu1kn
ryu1kn / README.md
Last active June 25, 2024 10:50
Getting GCP access token from a service account key JSON file

Getting GCP access token from a service account key

Use your service account's key JSON file to get an access token to call Google APIs.

Good for seeing how things work, including the creation of JWT token.

To create a JWT token, you can replace create-jwt-token.sh script with tools like step.

If you just want to get an access token for a service account,

@dinowang
dinowang / Main.m
Last active December 29, 2020 16:16
Objective-C program upload file to Azure Blob Storage with progress indicator
#import <AZSClient/AZSClient.h>
NSString *const AZURE_STORAGE_CONNECTION_STRING = @"DefaultEndpointsProtocol=https;AccountName=(your account name);AccountKey=(your account key);EndpointSuffix=core.windows.net";
NSString *const AZURE_STORAGE_CONTAINER = @"files";
NSString *const LOCAL_FILE_FILEPATH = @"/Users/dino/A.mp4";
NSString *const LOCAL_FILE_FILENAME = @"A.mp4";
NSError *error;
AZSCloudStorageAccount *account = [AZSCloudStorageAccount accountFromConnectionString:AZURE_STORAGE_CONNECTION_STRING error:&error];
AZSCloudBlobClient *client = [account getBlobClient];
@EugenMayer
EugenMayer / docs
Created July 28, 2016 18:19
/Library/LaunchDaemons/de.kontextwork.docker.loopback.plist
- name the file as you please, does not matter
- ensure the file is owned by root:wheel or it will not be used
It will create a loopback device 10.254.254.254 which can be used a remote_host in containers like xdebug configuration
- configure xdebug the way shown below.
Why all this?
- docker for mac will not allow to use connect_back
- you would need to use the user-specific ip of the current users interface ( eth/wlan ) in remote_host .. this way either your bootstrap becomes utterly complex or the dev images are not portable from developer to developer
@chinshr
chinshr / Jenkinsfile
Last active October 16, 2023 09:25
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}
@whatnickcodes
whatnickcodes / base64.js
Created April 24, 2014 15:01
How to Encode and Decode Strings with Base64 in JavaScript
// Create Base64 Object
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r
# First, Install Vagrant and Virtualbox then:
# Create new project directory
mkdir -p ~/Sites/newproject # Create new project directory
mk ~/Sites/newproject # Go into your new project directory
# Setup Vagrant
vagrant init
# Edit vagrant file box and box url to install Ubuntu, just like https://gist.github.com/fideloper/dab171a2aa646e86b782#file-vagrantfile-share-var-www-rb-L6-L8
# Edit Vagrantfile to create a static IP address, just like https://gist.github.com/fideloper/dab171a2aa646e86b782#file-vagrantfile-share-var-www-rb-L10
@joshbeckman
joshbeckman / animatedScrollTo.js
Created September 30, 2013 14:51
ScrollTo animation using pure javascript and no jquery
document.getElementsByTagName('button')[0].onclick = function () {
scrollTo(document.body, 0, 1250);
}
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;
#!/bin/sh
git clone https://github.com/laravel/laravel.git $1
cd $1
# Required for getting L4 dev
git reset --hard HEAD
git checkout develop
git remote rename origin upstream
@polka
polka / server_setup.md
Created June 17, 2012 18:25 — forked from twetzel/server_setup.md
Server Setup Ubuntu 10.4/rvm/nginx/passenger Hosteurope VM

Server Setup

Unsere Setup-Routine für eine Rails-App mit Nginx, Passenger, rvm auf einen Host Europe-VPS mit Ubuntu 10.4.

Installation der benötigten Pakete

apt-get update

apt-get install -y build-essential bison openssl libreadline5 libreadline5-dev curl \