This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Color blend | |
# | |
# Usage | |
# $ colorblend.rb cfd2ce 0.9 | |
# babdb9 | |
require 'color' | |
require 'pp' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!bin/sh | |
dirs=("xxxhdpi" "xxhdpi" "xhdpi" "hdpi" "mdpi") | |
for dir in "${dirs[@]}"; do | |
mkdir drawable-${dir} | |
for file in *${dir}.png; do | |
mv -- "$file" "drawable-${dir}/${file%%${dir}.png}.png" | |
done | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2017 Yuichi Hirano | |
// | |
// This software is provided 'as-is', without any express or implied | |
// warranty. In no event will the authors be held liable for any damages | |
// arising from the use of this software. | |
// | |
// Permission is granted to anyone to use this software for any purpose, | |
// including commercial applications, and to alter it and redistribute it | |
// freely, subject to the following restrictions: | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func runBench() { | |
let loop = 1000000 | |
let measurements = 100 | |
var total = 0.0 | |
// If condition loop | |
for _ in 0..<measurements { | |
let timeElapsed = timeElapsedInSecondsWhenRunningCode { | |
var num: Int = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <esp_event.h> | |
#include <esp_event_loop.h> | |
#include <esp_log.h> | |
#include <esp_system.h> | |
#include <esp_wifi.h> | |
#include <freertos/FreeRTOS.h> | |
#include <nvs_flash.h> | |
// Defines for WiFi | |
#define SSID "YOUR SSID" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# Download a random picture from Google image search. | |
# | |
# Usage: | |
# $ fetch_google_image.py cat cute # Download a cute cat picture | |
import os | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Download a beauty picture from http://4u-beautyimg.com/ | |
# | |
# Usage: | |
# $ fetch_4u.rb # Download a picture to /tmp/4u.jpg | |
# $ fetch_4u.rb ~/pic.jpg # Download a picture to ~/pic.jpg | |
require 'open-uri' | |
require "rexml/document" |
NewerOlder