Skip to content

Instantly share code, notes, and snippets.

View teknogeek's full-sized avatar

Joel Margolis teknogeek

View GitHub Profile
package crappyBird;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;

Keybase proof

I hereby claim:

  • I am teknogeek on github.
  • I am teknogeek (https://keybase.io/teknogeek) on keybase.
  • I have a public key whose fingerprint is B140 E540 EEC8 7FDC 0B6E C709 43A6 E743 664F B573

To claim this, I am signing this object:

@teknogeek
teknogeek / ace-browser-editor.md
Last active September 19, 2018 19:22
Ace Browser Editor

Change e.getSession().setMode(...) to "ace/mode/<language>" where <language> is your preferred programming language to have proper syntax highlighting. Then copy and paste the code into your browser bar and edit away :D.

data:text/html,
<div class="e" style="position: absolute; top: 0; right: 0; bottom: 0; left: 0;" id="editor"></div>
<script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
	var e = ace.edit("editor");
	e.setTheme("ace/theme/monokai");
	e.getSession().setMode("ace/mode/javascript");
<?php
class TelegramEncryption
{
public $key;
public $iv;
public $cipherText;
public $plainText;
public $debug;
public function __construct($key, $iv, $cipherText, $plainText, $debug = false)
@teknogeek
teknogeek / LuhnsAlgorithm-Full.py
Last active August 29, 2015 14:27
Super compressed version of Luhn's Algorithm in python
def luhnsChecksum(cardNumber):
#returns the actual digits in a string
def digitsOf(n):
return [int(d) for d in str(n) if d.isdigit()]
#get digits in card number
digits = digitsOf(cardNumber)
#get odd digits by incrementing backwards by -2 to -1
oddDigits = digits[-1::-2]
@teknogeek
teknogeek / The Technical Interview Cheat Sheet.md
Last active May 11, 2018 06:01 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
def main(one, two, three, four, five, six, seven, eight):
#b[o]ol + li[s]t = "os"
#need this so to import os
os = True.__class__.__name__[one] + [].__class__.__name__[two]
#[wr]apper_descriptor + tuple[ite]rator = "write"
#need this to do os.write
@teknogeek
teknogeek / robin-enhancement-suite.js
Last active April 3, 2016 00:21 — forked from sprngr/robin-enhancement-suite.js
Tampermonkey script to enhance the experience around Robin (Reddit's April Fool's prank/social experiment), enhanced further by teknogeek
// ==UserScript==
// @name Robin Enhancement Suite
// @namespace http://github.com/teknogeek
// @version 0.6.1
// @description Trying to make Robin more awesome (revised by teknogeek)
// @author teknogeek
// @credits sprngr
// @match https://www.reddit.com/robin*
// @grant none
// ==/UserScript==
@teknogeek
teknogeek / Robin-Enhancement-Suite.js
Created April 3, 2016 01:27
Robin Enhancement Suite, created by pta2002, upgraded by teknogeek
// ==UserScript==
// @name Robin Enhancement Suite
// @namespace com.pta2002.robines
// @description Enhances robin
// @include https://www.reddit.com/robin
// @include http://www.reddit.com/robin
// @include https://reddit.com/robin
// @include http://reddit.com/robin
// @include https://www.reddit.com/robin/
// @include http://www.reddit.com/robin/
@teknogeek
teknogeek / memoryhog.cpp
Created April 25, 2016 18:15
Snippet that causes g++ to hang and use gigabytes of ram (no template/include loops)
#include <stdio.h>
// tested on gcc-4.9.3 on linux gentoo amd64
// warning: compiling this will eat gigabytes of ram really fast so keep
// your CTRL-C ready
// compile with --std=c++14
struct v2f {
float x=0, y=0; // must be =0 to reproduce (probably works with other vals)
};