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 <ESP8266WiFi.h> | |
#include "Adafruit_MQTT.h" | |
#include "Adafruit_MQTT_Client.h" | |
#include <IRremoteESP8266.h> | |
#include <IRsend.h> | |
#include <IRrecv.h> | |
#include <IRutils.h> | |
#define WIFI_SSID "YOUR_NETWORK_NAME" | |
#define WIFI_PASS "YOUR_NETWORK_PASSWORD" |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <signal.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <syslog.h> | |
static void create_daemon() | |
{ |
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
import Foundation | |
final class LCG { | |
static func generate(modulus: Int, multiplier: Int, increment: Int, seed: Int) -> Int { | |
return (multiplier * seed + increment) % modulus | |
} | |
} | |
// Generating 100 random numbers using LCG | |
var seed = 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
// Simulating Dice Roll | |
var seed = 0 | |
for _ in 1...40000 { | |
let randomNumber = LCG.generate(modulus: 2147483648, multiplier: 1103515245, increment: 12345, seed: seed) | |
seed = randomNumber | |
let diceRoll = 1 + (randomNumber % 6) | |
print(diceRoll) | |
} |
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
// Simulating 1,000,000 random values in a given range | |
let upperBound: Double = 80 | |
let lowerBound: Double = 30 | |
let modulus = 2147483648 | |
var seed = 0 | |
for _ in 1...1000000 { | |
let randomNumber = LCG.generate(modulus: modulus, multiplier: 1103515245, increment: 12345, seed: seed) | |
seed = randomNumber |
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
// | |
// GaussianBlur.swift | |
// | |
// Created by Aryaman Sharda on 9/12/20. | |
// Copyright © 2020 com.DigitalBunker. All rights reserved. | |
// | |
import Foundation | |
import UIKit |
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
from PIL import Image | |
def boundedPixelValue(color, brightnessFactor): | |
scaledValue = float(color * (1 + brightnessFactor)) | |
if scaledValue < 0: | |
return 0 | |
elif scaledValue > 255: | |
return 255 | |
return int(scaledValue) |
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
from PIL import Image | |
# Converts image to grayscale | |
inputImage = Image.open("source.jpg").convert('L') | |
outputImage = Image.new('L', inputImage.size) | |
width, height = inputImage.size | |
# We first need to find the minimum and maximum pixel intensities | |
minIntensity = 255 |
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
from PIL import Image | |
# Converts image to grayscale | |
inputImage = Image.open("source.png").convert('L') | |
outputImage = Image.new('L', inputImage.size) | |
width, height = inputImage.size | |
frequency = {} |
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
import sys | |
from sys import argv | |
from struct import * | |
def compress(): | |
# Building and initializing the dictionary. | |
dictionary_size = 256 | |
dictionary = {chr(i): i for i in range(dictionary_size)} | |
# We'll start off our phrase as empty and add characters to it as we encounter them |
OlderNewer