Skip to content

Instantly share code, notes, and snippets.

@devwolf75
devwolf75 / toTimezone.ts
Created February 14, 2020 04:24
Typescript function that takes a Date, string or moment object and converts it between timezones.
import * as moment from "moment-timezone";
/**
* @description
* @param {Date | string | moment} date Date to transform.
* @param {string} originTZ Timezone in which the date to transform is currently. I.E. "UTC". Defaults to client PC TZ.
* @param {string} destinationTZ Timezone to which to convert the date. I.E. "America/Los Angeles". Defaults to "UTC".
* @return {string} Date converted to destination timezone in string.
*
*/
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command": "closePane",
@devwolf75
devwolf75 / JFrame.java
Created March 8, 2019 18:52
JFrame example.
import javax.swing.JFrame;
import javax.swing.JPanel;
class Main {
private static final String TITLE = "My Game";
private static final int[] DIMENSIONS = {800, 600};
public static void main(String s[]) {
@devwolf75
devwolf75 / PROFILE.md
Last active March 4, 2019 19:06
How to remove PowerShell aliases for Scoop installs of tools like Coreutils and other GNU applications
remove-item alias:basename
remove-item alias:cat
remove-item alias:chmod
remove-item alias:comm
remove-item alias:cp
remove-item alias:cut
remove-item alias:date
remove-item alias:dirname
remove-item alias:echo
@devwolf75
devwolf75 / GuessingGame.py
Last active October 3, 2018 22:08
Play an implementation of a guessing game against the PC.
import logging
import random
ENTER_HIGHEST_VALUE = "What would you like the highest value to be?"
NUMBER_NOT_VALID = "That is not a number. :("
NUMBER_NOT_IN_RANGE = "I don't know how to play with negative numbers. Sorry... :("
NUMBER_CANNOT_BE_HIGHER_THAN = "Sorry, but the guess cannot be higher than the highest number:"
ENTER_GUESS = "Guess the number. :)"
TRY_AGAIN = "Try again."
HIGHER = "My number is higher!"
@devwolf75
devwolf75 / GuessingGame.py
Created October 3, 2018 19:14
Play an implementation of a guessing game with the computer.
import logging
import random
ENTER_HIGHEST_VALUE = "What would you like the highest value to be?"
NUMBER_NOT_VALID = "That is not a number. :("
NUMBER_NOT_IN_RANGE = "I don't know how to play with negative numbers. Sorry... :("
NUMBER_CANNOT_BE_HIGHER_THAN = "Sorry, but the guess cannot be higher than the highest number:"
ENTER_GUESS = "Guess the number. :)"
TRY_AGAIN = "Try again."
HIGHER = "My number is higher!"
@devwolf75
devwolf75 / GuessingGame.py
Created October 3, 2018 19:14
Play an implementation of a guessing game with the computer.
import logging
import random
ENTER_HIGHEST_VALUE = "What would you like the highest value to be?"
NUMBER_NOT_VALID = "That is not a number. :("
NUMBER_NOT_IN_RANGE = "I don't know how to play with negative numbers. Sorry... :("
NUMBER_CANNOT_BE_HIGHER_THAN = "Sorry, but the guess cannot be higher than the highest number:"
ENTER_GUESS = "Guess the number. :)"
TRY_AGAIN = "Try again."
HIGHER = "My number is higher!"
try
{
}
catch(e)
{
var error = "http://stackoverflow.com/search?q=[js]+"+e.message;
window.open(error, '_blank');
}
@devwolf75
devwolf75 / Config.md
Created November 11, 2015 22:50
Configuración de Routers para packet tracer CCNA 4

ROUTER R1

en
conf t

CONFIGURACION BÁSICA

hostname R1
no ip domain-lookup
enable secret class
banner motd #WELCOME TO ROUTER R1!#
line con 0
logging synchronous

@devwolf75
devwolf75 / Codigo PetFeeder
Created April 16, 2015 18:55
Codigo para proyecto de petfeeder
RECIBIR.php
<?php
$puerto="/dev/ttyACM0";
if(isset($_GET["codigo"]))
{
$codigo = $_GET["codigo"];
if($codigo == 2)
{
$conexion = fopen($puerto, "w+");