Skip to content

Instantly share code, notes, and snippets.

View the-vampiire's full-sized avatar
💭
ive lost a shade of color in my life. rest in peace.

the-vampiire

💭
ive lost a shade of color in my life. rest in peace.
View GitHub Profile
@the-vampiire
the-vampiire / FIX_MY_NAME.sh
Last active March 25, 2023 22:19
Django + PostgreSQL Google Cloud Flexible App Engine deployment templates [app.yaml, settings.py, Conda environment loader shell scripts]
# when you call conda deactivate this script will be executed
# removes the environment variables automatically on environment deactivation
# this goes in /anaconda3/envs/ENVIRONMENT-NAME/etc/conda/deactivate.d
# CHANGE FILE NAME TO 'env_vars.sh' (gist requires unique file names...)
unset DEBUG SECRET_KEY DB_HOST DB_PORT DB_NAME DB_USER DB_PASSWORD STATIC_URL
@the-vampiire
the-vampiire / spectre.c
Created January 9, 2018 06:42 — forked from ErikAugust/spectre.c
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@the-vampiire
the-vampiire / searchByID.js
Last active December 29, 2017 08:08
Searches through the nodes of the DOM tree (or a specified sub-collection) seeking an element with the passed targetID.
/**
* @param {String} targetID - [targetID: required]
* - HTML element ID of the target element
* @param {Object} collection - [collection: optional (increased search speed)]
* - HTML collection of child nodes to search through. If no collection is passed the search begins across all top-level elements in the document
* @param {String} targetTag - [targetTag: optional (increased search speed)]
* - HTML tagName of the element (speeds search).
* @returns {[Object]}
* @description Searches through the nodes of the DOM tree (or a specified sub-collection) seeking an element with the passed targetID.
*
@the-vampiire
the-vampiire / letter.md
Created November 23, 2017 08:20
my letter to the team

@here ive awoken from my coma. reading what @Oxyrus and @Jim Medlock said has been exactly what i needed. the lessons and focus that was gained from this experience is what will prove more valuable than any tangible prize.

pouring out everything we had about Chingu is what is going to make the most difference in my opinion. getting all of that data together, organizing our mission, recording sound and video promotional material. those adrenaline fueled savage modes is where a primal focus is borne. without that intensity we would not have anywhere near this complete level of understanding of both Chingu as a community and its future as a training grounds.

on a personal level i received both the rejection from LaunchCode and this “failure” in a 72 hour period. both of these were — what i saw — as pivotal moments in Chingu’s future. but i dont feel hurt or really even fazed by any of this. these to me are what the great leaders and revolutionary business people have always talked about when they said success

@the-vampiire
the-vampiire / jim.md
Created November 23, 2017 08:17
Jim's Letter

This is an unsolicited perspective and advice. As such you may not want to hear it right now, but I’m going to provide it anyway. This is for just this team (yes Chance you too).

First and foremost you are going through a lot of emotions right now that are probably clouding your rational thoughts. You are disappointed, you feel like you’ve failed, you are each assuming personal responsibility for this outcome. You are also exhausted. You’ve been working like madmen so you probably haven’t been taking care of yourselves — not exercising, not eating, maybe even having one beer too many after last night.

First and foremost, yes the deadline was missed and our submission didn’t go it. That’s a “miss”, but its not a failure when you consider you efforts within the larger context of the Chingu “platform” and what we have set out to accomplish. Missing the submission deadline is a disappointment after all of your hard work, but in this larger context it’s a huge win for the Chingu’s.

Not only will the CDN be bett

@the-vampiire
the-vampiire / submission.md
Created November 23, 2017 08:12
Chingu Developer Network Submission

Inspiration

In anticipation of Chingu’s growth the veteran members of the community and its founder, Chance, had begun planning for an ambitious next phase. In doing so we moved our deadline from February to December 1st (the time that the next Chingu remote dev cohort is to begin). The next cohort already has over 400 users applied and the only way to manage the influx of users and project collaboration is through a unified Chingu Developer Network [CDN]. As of Friday at 9pm UTC-5 the Chingu X team had set its sight on a December 1st delivery. On Saturday morning our senior-most member, TheSabby - from Jordan, visited a Facebook developer’s conference. It was here that we planned to gain valuable insight into GraphQL and React - the two core technologies of the CDN. In discussing GraphQL with one of the Facebook developers the purpose of our project and of our community at large was brought to light. The Facebook developer was so inspired by our mission that he urged us to do anything we could to enter t

@the-vampiire
the-vampiire / hourglass_sum.js
Created November 14, 2017 05:17
More detailed pseudocode / JS solution
const arr = [
[ 1, 1, 1, 0, 0, 0 ],
[ 0, 1, 0, 0, 0, 0 ],
[ 1, 1, 1, 0, 0, 0 ],
[ 0, 9, 2, -4, -4, 0 ],
[ 0, 0, 0, -2, 0, 0 ],
[ 0, 0, -1, -2, -4, 0 ]
];
@the-vampiire
the-vampiire / hourglass_sum.py
Last active November 14, 2017 05:10
2-dimensional array problem - HackerRank (https://www.hackerrank.com/challenges/2d-array/problem)
"""
Problem Statement:
Calculate the hourglass sum for every hourglass in the 2D array, then print the maximum hourglass sum.
"""
"""
Approach:
A B C
@the-vampiire
the-vampiire / unit_tester.py
Created October 31, 2017 08:53
UnitTester Class
def unit_test(function_to_test, test_input, expected_output):
try:
number_of_inputs = len(test_input)
if type(test_input) == list: function_output = function_to_test(test_input)
elif number_of_inputs == 1: function_output = function_to_test(test_input)
elif number_of_inputs == 2: function_output = function_to_test(test_input[0], test_input[1])
elif number_of_inputs == 3: function_output = function_to_test(test_input[0], test_input[1], test_input[2])
except Exception as error:
print("Error occurred with test input: [{0}] value: {1}\nError Message: {2}\nCorrect the error and try again.\n"
@the-vampiire
the-vampiire / unit_tester_annotated.py
Last active October 28, 2017 07:29
Simple Unit Testing Environment
# performs a single unit test
# accepts a function to test, a test case input and its corresponding expected output
def unit_test(function_to_test, test_input, expected_output):
try: # try something (whatever is in the code block)
function_output = function_to_test(test_input)
except Exception as error: # if it DOES NOT work then catch the error using the except keyword
# Exception is a general "catch-all" exception
# catch the Exception and store the error message as a variable called error
print("Error occurred with test input: [{0}] value: {1}\nError Message: {2}\nCorrect the error and try again.\n"