Skip to content

Instantly share code, notes, and snippets.

View mattiasrunge's full-sized avatar

Mattias Runge-Broberg mattiasrunge

View GitHub Profile
@steven2358
steven2358 / ffmpeg.md
Last active November 11, 2024 04:45
FFmpeg cheat sheet
@imranity
imranity / get-api-token-of-user-jenkins-groovy.md
Last active June 7, 2021 14:24
jenkins groovy get API token of a user

This is pretty simple snippet to get API Token of a user , lets say "MYUser" in jenkins.
its pretty useful when you are working with 'jenkins-job-builder' to update jobs in jenkins, and you need to get the api token which JJB needs inorder to update jobs to ..
run this code in either jenkins script console , or as i prefer, in form of init.groovy.
so when jenkins master starts, i create a user for JJb.
after that i get the token right away and pass it to my JJB jobs folder to file 'jenkins_jobs.ini' :)_ .

///////////////////////////////////////////////////////////////////////
@davemo
davemo / api.proxy.server.js
Created November 6, 2012 21:56
A simple express.js server with a proxy that intercepts all requests with /api/ and proxies them to localhost:3000
var express = require('express'),
httpProxy = require('http-proxy'),
app = express();
var proxy = new httpProxy.RoutingProxy();
function apiProxy(host, port) {
return function(req, res, next) {
if(req.url.match(new RegExp('^\/api\/'))) {
proxy.proxyRequest(req, res, {host: host, port: port});
@mattiasrunge
mattiasrunge / utctimestamp.c
Created May 10, 2012 21:25
Get UTC epoch timestamp function
#include <stdio.h>
#include <time.h>
#include <string.h>
/**
* This function returns a UTC epoch timestamp based on
* the supplied time information.
*
* @param [in] second Seconds [0-59]
@mbostock
mbostock / .block
Last active February 26, 2019 22:34
Random Tree
license: gpl-3.0
redirect: https://observablehq.com/@mbostock/random-tree