Skip to content

Instantly share code, notes, and snippets.

View janisz's full-sized avatar
🏠
Working from home

Tomasz Janiszewski janisz

🏠
Working from home
View GitHub Profile
@tekin
tekin / .gitattributes
Last active July 9, 2024 20:31
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details.
# Stick this in your home directory and point your Global Git config at it by running:
#
# $ git config --global core.attributesfile ~/.gitattributes
#
# See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp
#!/usr/bin/python
"""
Script to migrate marathon tasks from the host going for maintenance
optional arguments:
-h, --help show this help message and exit
--url URL Marathon URL (http://marathon.example.com)
--hosts HOSTS Hosts going to go for maintenance
@druminski
druminski / Readme.md
Last active July 4, 2022 01:11
BigCache service example with external benchmarks

Cache service example. It uses fasthttp as an http server and bigcache as the cache.

External benchmarks are provided.

Running cache service

go run main.go

Server listens on 8080 port.

@Kornel
Kornel / recursive-cowsay.sh
Last active February 4, 2016 14:18
Recursive cowsay inception - random cow at every step
#!/usr/bin/env bash
COWS_PATH="/usr/local/share/cows"
COW_FILES=($(ls $COWS_PATH))
COWS=${#COW_FILES[@]}
rand_cow() {
#RAND_IDX=$(($RANDOM % $COWS))
RAND_IDX=$((`od -vAn -N4 -tu4 < /dev/urandom` % $COWS))
@winterz
winterz / setup-travis.sh
Last active May 25, 2017 01:10
travis CI setup script
#/bin/sh -f
# things to do for travis-ci in the before_install section
if ( test "`uname -s`" = "Darwin" )
then
#cmake v2.8.12 is installed on the Mac workers now
#brew update
#brew install cmake
echo
@LindsayBradford
LindsayBradford / build.gradle
Last active February 26, 2019 14:39
Gradle script for LaTeX pdf generation.
/*
* Usage:
* all LaTeX source files go in $rawDirectory
* base document to 'cook' should match content of $latexFile
* build script delivers resulting PDF file to $cookedDirectory
*/
defaultTasks 'full'
ext { documentBase = 'myBaseLaTeXFileName' }
@davidvthecoder
davidvthecoder / round.go
Created April 9, 2014 19:58
Arggh Golang does not include a round function in the standard math package. So I wrote a quick one.
package main
import (
"log"
"math"
)
func Round(val float64, roundOn float64, places int ) (newVal float64) {
var round float64
pow := math.Pow(10, float64(places))
@mbijon
mbijon / apc.php
Created March 22, 2014 01:16
APC monitor & cache management dashboard
<?php
/*
+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2011 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cuda.h>
#define BLOCKS 10
#define THREADS 100
#define ELEMENTS_COUNT (BLOCKS*THREADS)
#define DATA_SIZE (ELEMENTS_COUNT * sizeof(storeElement))
#define COMPRESSED_ELEMENT_SIZE 10
@janisz
janisz / Boost install
Created November 27, 2013 20:24
Boost instalation script. Sometimes not working
#!/bin/bash
#Update repositories list
sudo apt-get update
#Completely remove boost
sudo apt-get -y --purge remove libboost-all-dev libboost-doc libboost-dev
sudo rm -f /usr/lib/libboost_*
#Install required packages