Skip to content

Instantly share code, notes, and snippets.

View telmotrooper's full-sized avatar
🐧
➜ ~ echo "Hello, World\!" | lolcat

Telmo "Trooper" telmotrooper

🐧
➜ ~ echo "Hello, World\!" | lolcat
View GitHub Profile
@telmotrooper
telmotrooper / toggle_touchpad.sh
Last active May 28, 2018 13:01
Toggle touchpad script (recommended shortcut is "Ctrl + \")
#!/bin/bash
var=$(synclient -l | grep TouchpadOff)
if [[ "$var" == " TouchpadOff = 0" ]]; then
synclient TouchpadOff=1
else
synclient TouchpadOff=0
fi
@telmotrooper
telmotrooper / wsh.bat
Last active April 15, 2017 15:10
Script to shutdown your Windows system in a given number of hours
@echo off
title Windows Shutdown Helper
echo ###########################
echo # Windows Shutdown Helper #
echo ###########################
set /p hours= "Hours to shutdown: "
set /a seconds= (%hours% * 60 * 60)
@telmotrooper
telmotrooper / DBGuy.java
Last active February 7, 2017 01:59
Basic PostgreSQL/Java example
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",
@telmotrooper
telmotrooper / FBullCowGame.cpp
Last active January 27, 2017 00:40
BullCowGame with difficulty settings
/*
This is the implementation of the FBullCowGame header.
*/
#pragma once
#include "FBullCowGame.h"
#include <map>
#define TMap std::map
FBullCowGame::FBullCowGame() {Reset();}
@telmotrooper
telmotrooper / random_message.py
Last active May 21, 2016 21:07
Reads a random message from a file and prints it
"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","")
@telmotrooper
telmotrooper / safe_input.py
Last active March 7, 2016 20:29
Guarantees that the user input respects the specified built-in type.
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: