Skip to content

Instantly share code, notes, and snippets.

View Nikitaw99's full-sized avatar

Nikitaw99 Nikitaw99

  • Russia
View GitHub Profile
@Nikitaw99
Nikitaw99 / microcont.lua
Last active March 23, 2017 18:49
sample microcontroller program for opencomputers minecraft mod. when it receives a redstone signal in the front, it beeps
local rs = component.proxy(component.list("redstone")())
while true do
if rs.getInput(3) > 0 then
computer.beep()
end
computer.pullSignal()
end
@Nikitaw99
Nikitaw99 / bad_heaven.py
Created March 5, 2017 19:11
python3 bad_heaven.py
bad = open("bad_lyrics.txt", mode="r").read()
heaven = open("heaven_lyrics.txt", mode="r").read()
new = open("new_lyrics.txt", mode="w")
bad = bad.replace("bad", heaven)
new.write(bad)
new.close()
@Nikitaw99
Nikitaw99 / test.py
Created March 5, 2017 11:58
testing `unittest`
def say_hi(name='World'):
if name == None or name == '':
name = "World"
if type(name) != str:
name = str(name)
return f"Hello, {name}!"
@Nikitaw99
Nikitaw99 / time.py
Created March 3, 2017 18:13
discord.py time command (based on orangestation-bot)
elif message.content.startswith("AI, time"):
# UTC
tmp1 = datetime.datetime.now()
utcnow = datetime.time(hour=tmp1.hour, minute=tmp1.minute, second=tmp1.second)
del tmp1
utcfulltime = "{}:{}:{}".format(utcnow.hour, utcnow.minute, utcnow.second)
# SMT
tmp1 = datetime.timedelta(hours=4)
smt = datetime.timezone(tmp1)
@Nikitaw99
Nikitaw99 / DatBoi.rb
Last active January 9, 2017 10:35
messing around with ruby
require "date"
class DatBoi
attr_accessor :name
attr_accessor :life
attr_accessor :bornIn
attr_accessor :currentDate
attr_accessor :alive
def initialize(name = "Dat Boi", life = 365*4, bornIn = Date.parse("2016-04-03"))
@name = name
@life = life
[scenario]
id=chapter1
next_scenario=chapter2
name=Chapter 1 - The Port In Ruins
map_data="{~add-ons/The_Invasion/scenarios/maps/prologue.map}"
turns=27
{DEFAULT_SCHEDULE}
@Nikitaw99
Nikitaw99 / fe-calc.lua
Created September 4, 2016 19:23
Simple Fire Emblem battle simulator.
math.randomseed(os.time())
print("Enter attacker skill stat:")
skill = io.read('*n')
while skill > 100 or skill < 0 do
print("This number is invalid.")
print("The number must be between 0 and 100.")
print("Enter attacker skill stat:")
skill = io.read('*n')
end
import discord
import asyncio
import textile
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name )
import discord
import asyncio
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name )
print(client.user.id)
#include <iostream>
int getUserInput() {
std::cout << "Please input an integer: ";
int value;
std::cin >> value;
return value;
}
int getMathematicalOperation() {