Skip to content

Instantly share code, notes, and snippets.

View c272's full-sized avatar

C272 c272

  • Tokyo, Japan
  • 11:52 (UTC +09:00)
View GitHub Profile
int i = 3;
if (i<001) {
console.log("My fifth gist.");
} else {
console.log("My first gist.");
}
@c272
c272 / quad.py
Last active May 8, 2018 08:35
Quadratic Formula in Python 3
#Quadratic formula import, Python 3.6
#C272, 2018
from math import *
def solveQuad(a,b,c):
a = float(a)
b = float(b)
c = float(c)
rootb = sqrt(b)
@c272
c272 / badsort.py
Created May 9, 2018 19:49
The worst sorting algorithm the world has ever seen.
# The shittiest sorting algorithm on planet earth.
# @Poltroon @C272
from random import shuffle
arr = [0,12,99,13,17,19,6]
#Searching.
done = "false"
pnum = 0
while (done=="false"):
@c272
c272 / loadpng.cpp
Created June 28, 2018 09:54
Loading .PNG in SDL2 in 78 lines.
//Including SDL and standard headers.
//Note that you'll have to include all the libraries and include paths,
//and on Windows include a copy of SDL.dll and SDL_image.dll in the application directory.
#include <SDL.h>
#include <SDL_image.h>
#include <stdio.h>
#include <string>
//Predefining functions/variables.
SDL_Surface* loadPNGSurface(std::string);
@c272
c272 / prettyprint.cs
Last active April 29, 2019 20:59
Simple JSON pretty printing in C#, as a string extension.
public static class StringExtensions {
//Returns the string, if JSON, as a pretty printed string.
public static string PrettyPrint(this string d)
{
IList<string> actionLines = d.SplitAndKeepDelimiters('{', '}', ',');
string s = "";
//Write per line, leave space between each action.
int tabDepth = 0;
@c272
c272 / bezl.js
Last active July 2, 2019 20:08
A terrible EZ_n lock solver, 500 characters.
function(ctx, args)
{
//ca = call arguments, r = response, ezs = ez index.
var ca={},r
var strs = "open unlock release 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97".split(" ")
//initially call func to get response.
function c() {
r = args.t.call(ca)
}
@c272
c272 / stuck.js
Last active July 2, 2019 20:27
:think:
function(ctx, args)
{
//ca = call arguments, r = response, ezs = ez index.
var ca={},r,i
var ez = "open unlock release".split(" ")
, p = "2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97".split(' ')
//initially call func to get response.
function c() {
r = args.t.call(ca)
@c272
c272 / parseme.cs
Created July 24, 2019 17:44
Dynamic JSON parsing in .NET.
string JSON = "{someObj:{someNested:\"\"}}";
dynamic arr = JObject.Parse(JSON); //JArray.Parse() for arrays
foreach (dynamic token in arr)
{
JTokenType type = ((JToken)token.value).Type;
switch (type)
{
case JTokenType.String:
@c272
c272 / xml_prettyprint.cs
Last active March 11, 2020 20:16
Returns a pretty print string of a given XML string, with escape characters added in for invalid chars.
/// <summary>
/// Formats a given string into pretty print XML.
/// </summary>
private string FormatXml(string xml)
{
try
{
XDocument doc = XDocument.Parse(xml);
//Get the string representation out.
@c272
c272 / tf2_mvm_pop_file_keywords_20171214a.txt
Created October 29, 2020 18:21 — forked from sigsegv-mvm/tf2_mvm_pop_file_keywords_20171214a.txt
TF2 MvM Pop File Keywords, as of Dec 14 2017
TF2 MVM POP FILE KEYWORDS LIST
by sigsegv
accurate as of TF2 20171214a
note that some valid keywords listed in this document may be vestigial and do nothing in the current game
Base KeyValues Format "Directives"
==================================
#include "file"
#base "file"