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
def input_float(msg): | |
while True: | |
try: | |
return float(input(msg)) | |
except ValueError: | |
print("The input value is not a float.") | |
def input_int(msg): | |
while True: |
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
"Reads a random message from a file and prints it" | |
from random import randint | |
with open("antichamber.txt") as file: | |
messages = file.readlines() | |
file_title = messages[0].replace("\n","") | |
random_number = randint(1, len(messages)-1) | |
random_message = messages[random_number].replace("\n","") |
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
/* | |
This is the implementation of the FBullCowGame header. | |
*/ | |
#pragma once | |
#include "FBullCowGame.h" | |
#include <map> | |
#define TMap std::map | |
FBullCowGame::FBullCowGame() {Reset();} |
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 java.sql.*; | |
public class DBGuy { | |
private Connection c = null; | |
public DBGuy() { | |
try { | |
Class.forName("org.postgresql.Driver"); | |
c = DriverManager | |
.getConnection("jdbc:postgresql://localhost:5432/testdb", |
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
@echo off | |
title Windows Shutdown Helper | |
echo ########################### | |
echo # Windows Shutdown Helper # | |
echo ########################### | |
set /p hours= "Hours to shutdown: " | |
set /a seconds= (%hours% * 60 * 60) |
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/bash | |
var=$(synclient -l | grep TouchpadOff) | |
if [[ "$var" == " TouchpadOff = 0" ]]; then | |
synclient TouchpadOff=1 | |
else | |
synclient TouchpadOff=0 | |
fi |
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 shutil import copyfile | |
copyfile("in.txt", "out.txt") | |
inputFile = open("in.txt", "r") | |
outputFile = open("out.txt", "a") | |
outputFile.write("\n\n") | |
for line in inputFile.readlines(): |
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
xprop _NET_WM_PID | cut -d' ' -f3 |
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
class Sudoku: | |
"""Sudoku validator""" | |
grid = [[0] * 9 for i in range(9)] | |
def __init__(self): | |
self.populate_grid() | |
self.print_grid() | |
self.validate_grid() |
OlderNewer