Skip to content

Instantly share code, notes, and snippets.

@DTSCode
DTSCode / Lesson_plan.txt
Last active September 28, 2015 20:28
A collection of titles for my various up and coming lessons
1) Why C is better than c++
2) Why #1 is a lie
3) Santa is a lie and why this applies to #1
* recent evidence that number 3 itself might be a lie. wtf does this mean for the guild!!??!?!
4) Programs are whores who want your memory
5) Programmers are sluts who give them memory
19) Programming makes no sense and is largely documented
6) Memory is a bitch
7) You will never be as good a programmer as Hitler
8) what animes to watch while programming
/*
+ : Increments the value at the current cell by one.
- : Decrements the value at the current cell by one.
> : Moves the data pointer to the next cell (cell on the right).
< : Moves the data pointer to the previous cell (cell on the left).
. : Prints the ASCII value at the current cell (i.e. 65 = 'A').
, : Reads a single input character into the current cell.
[ : If the value at the current cell is zero, skips to the corresponding ] .
Otherwise, move to the next instruction.
] : If the value at the current cell is zero, move to the next instruction.
@DTSCode
DTSCode / timeout.nim
Last active August 29, 2015 14:22
simple timeout script written in nim for a ZNC bouncer. After 10 minutes of inactivity it sends "AWAY :<nick> is currently afk (set by timeoutbot)". After becoming active again it sends "AWAY" to the server. To change it to suit your needs, edit all of the top const variables to their appropriate values.
import irc, asyncdispatch, posix
const
time: cint = 600
server: string = "dtscode.io"
port: int = 3038
nick: string = "dtscode"
user: string = "dtscode"
real: string = "nchambers - dtscode.io"
pass: string = "REDACTED_PASSWORD"
import irc, asyncdispatch
import strutils
import times
proc getDaysLeft(year_s: string, today: string, holiday: string): string =
var table = @[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
var month: int
var day: int
var dayOfTheYear: int = 0
var dayOfChristmas: int = 358
@DTSCode
DTSCode / tables
Last active August 29, 2015 14:18
CREATE TABLE Nicks ( id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, nick VARCHAR(200) NOT NULL);
CREATE TABLE Quote (
id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
grabber_id MEDIUMINT UNSIGNED NOT NULL,
sayer_id MEDIUMINT UNSIGNED NOT NULL,
quote VARCHAR(1500) NOT NULL,
CONSTRAINT `fk_grabber_id`
FOREIGN KEY (grabber_id) REFERENCES Nicks (id)
ON DELETE CASCADE,
@DTSCode
DTSCode / racketball.rkt
Last active August 29, 2015 14:18
Racketball - A webserver written in racket
#lang racket
(define (serve port-no)
(define listener
(tcp-listen port-no 5 #t))
(define (loop)
(accept-and-handle listener)
(loop))
(loop))
@DTSCode
DTSCode / MY FIRST LESSON!!!!!!
Created December 2, 2014 01:49
The basics of std::basic_stream<char>
The basics of std::basic_stream<char>
=====================================
As a part of the standard library, a class is defined called basic_stream<char>, which is typedef-ed to look like this:
typedef std::basic_stream<char> std::istream; // note that it might not look exactly like this, but it will evaluate to the same thing
The most known instance of std::istream is std::cin, which is linked to stdin, and currently all we are focusing on. There are two common operations used on std::cin. The first is operator >>, which reads one token from the input stream. There are two new terms here: token, and input stream. The input stream is literally just the collection of characters that are waiting to be read in to variables. In the case of std::cin, these characters typically come from the keyboard. For example, if I were to type "My name is DTSCode and I am an 3l1t3 h4xx0r. 10 20 30.4 -7", then that is what the input stream would consist of. The second term, token, is just a part of the input stream. Contin
@DTSCode
DTSCode / ai.cpp
Last active August 29, 2015 14:10
A* implementation in c++ using the standard library
#include <iostream>
#include <array>
#include <utility>
class node {
public:
node(bool=true);
node &operator=(bool);
friend std::ostream &operator<<(std::ostream&, const node&);
@DTSCode
DTSCode / Too learn
Created November 12, 2014 08:53
DTSCode's programming language backlog
php/hack
c
c++
python3
ruby
perl
AT&T assembly
javascript
haskell
crystal
@DTSCode
DTSCode / example.ts
Last active August 29, 2015 14:09
example.ts - shows off some basic features of the language
import stdlib
routine main : string args
while true
print("Please enter a number between 1-10: ")
int num = NOVAL
read(num)
if num < 1
print("Too Small. Wrong. ")