Skip to content

Instantly share code, notes, and snippets.

View FottyM's full-sized avatar
🦥
Focusing

Fortunat Mutunda FottyM

🦥
Focusing
View GitHub Profile
#!/bin/bash
# Log function to print messages to stdout and stderr
function log {
if [ $1 == "success" ]; then
echo -e "\033[32m[`date +'%Y-%m-%d %H:%M:%S'`] $2\033[0m"
else
echo -e "\033[31m[`date +'%Y-%m-%d %H:%M:%S'`] $2\033[0m" >&2
fi
}
@FottyM
FottyM / dnsmasq macOS.md
Last active April 4, 2021 13:05 — forked from brablc/dnsmasq macOS.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.locahost domains, e.g. project.localhost, awesome.localhost and so on, without having to add to your hosts file each time.

Requirements

Install

var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@FottyM
FottyM / docker-cleanup-resources.md
Created October 11, 2018 07:21 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@FottyM
FottyM / ImmutableJSExamples.js
Created September 20, 2018 12:16 — forked from singhshivam/Immutable JS Examples
Immutable JS Examples
List()
var list = Immutable.List([1,2,3])
// [1, 2, 3]
List.isList()
Immutable.List.isList(list)
// true
List.of()
var list = Immutable.List.of(1,2,3);
@FottyM
FottyM / made-with-love.html
Created February 17, 2018 13:02 — forked from oliveratgithub/made-with-love.html
Various HTML-snippets to add "Made with love" to your website
<!-- Example #1 - no styling -->
Made with ❤ in Switzerland
<!-- Example #2 - inline-styled ❤ -->
Made with <span style="color: #e25555;">&#9829;</span> in Switzerland
Made with <span style="color: #e25555;">&hearts;</span> in Switzerland
<!-- Example #3 - CSS-style class for ❤ -->
<style>.heart{color:#e25555;}</style>
Made with <span class="heart">❤</span> in Switzerland
@FottyM
FottyM / x.c
Created January 13, 2018 21:59
#include<stdio.h>
int is_prime(int num)
{
if (num <= 1) return 0;
if (num % 2 == 0 && num > 2) return 0;
for(int i = 3; i < num / 2; i+= 2)
{
if (num % i == 0)
return 0;
#include<stdio.h>
int main()
{
int y,i,num;
printf("Enter the number of integers you need:");
scanf(" %d", &y);
int r1[y];
printf("Enter a number:");
scanf(" %d", &num);
for( i=1; i<=y; i++){
@FottyM
FottyM / _usage.md
Created January 3, 2018 04:59 — forked from tbranyen/_usage.md
OpenWeatherMap / Weather Icons integration
  1. Include Weather Icons in your app: https://github.com/erikflowers/weather-icons

  2. Include the below JSON in your application, for example purposes, lets assume it's a global named weatherIcons.

  3. Make a request to OpenWeatherMap:

req = $.getJSON('http://api.openweathermap.org/data/2.5/weather?q=London,uk&callback=?');
contract Process_0g28l4d_Contract {
uint tokens = 1;
uint subprocesses = 0;
uint hours_before_checking_72_time = 0;
uint Checkout_date_time = 0;
function hours_before_checking_72(uint localTokens) internal returns (uint) {
hours_before_checking_72_time = now;
return localTokens & uint(~2) | 4;
}