Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Jan Baer janbaer

🏠
Working from home
Block or report user

Report or block janbaer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@janbaer
janbaer / read-lines-from-a-file.sh
Created Jan 25, 2019
Read all lines from the passed file and do something with each line
View read-lines-from-a-file.sh
while IFS='' read -r line || [[ -n "$line" ]]; do
youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' $line
done < "$1"
@janbaer
janbaer / rename.sh
Created Jan 25, 2019
Rename files that are located in the current directory
View rename.sh
for FILE in *.mp4; do
mv "$FILE" "`echo $FILE | sed -r "s/^(.+)_hd-froscon16.+.mp4$/\1.mp4"/`";
done
@janbaer
janbaer / github-graphql-api.md
Last active Dec 23, 2018
Some Github API GraphQL calls
View github-graphql-api.md

Github API GraphQL calls

All repositories of a user

query { 
	user(login:"janbaer") {
    name,
    avatarUrl,
    repositories(first: 100) ,{
@janbaer
janbaer / 01-curl.go
Created Nov 18, 2016 — forked from jmoiron/01-curl.go
io.Reader & io.Writer fun
View 01-curl.go
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func init() {
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@janbaer
janbaer / Dockerfile
Created Oct 22, 2016 — forked from andyshinn/Dockerfile
BusyBox cron container example
View Dockerfile
FROM gliderlabs/alpine:3.3
COPY myawesomescript /bin/myawesomescript
COPY root /var/spool/cron/crontabs/root
RUN chmod +x /bin/myawesomescript
CMD crond -l 2 -f
@janbaer
janbaer / docker-compose-install.sh
Created Jan 3, 2016 — forked from marszall87/docker-compose-install.sh
Simple script for installing latest Docker Compose on CoreOS >= 717.0.0
View docker-compose-install.sh
#!/bin/bash
mkdir -p /opt/bin
curl -L `curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("Linux") and contains("x86_64"))'` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
@janbaer
janbaer / git-purge.ps1
Last active Mar 4, 2016
Purges all remote deleted feature branches locally
View git-purge.ps1
function Git-Purge () {
  git fetch -p | git branch --color=never --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | xargs -n 1 git branch -d
}
@janbaer
janbaer / count_angular_watches.js
Created Apr 15, 2015
Count the number of Angular watches
View count_angular_watches.js
(function () {
var root = angular.element(document.getElementsByTagName('body'));
var watchers = [];
var f = function (element) {
angular.forEach(['$scope', '$isolateScope'], function (scopeProperty) {
if (element.data() && element.data().hasOwnProperty(scopeProperty)) {
angular.forEach(element.data()[scopeProperty].$$watchers, function (watcher) {
watchers.push(watcher);
@janbaer
janbaer / index.html
Created Sep 16, 2014
Angular promises
View index.html
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body ng-app="MyApp">
<div ng-controller="MyController">
<button ng-click="fetchData()">Fetch data</button>
You can’t perform that action at this time.