Skip to content

Instantly share code, notes, and snippets.

View qaisjp's full-sized avatar
🧪
why has the new github hidden statuses?

Qais Patankar qaisjp

🧪
why has the new github hidden statuses?
View GitHub Profile
@qaisjp
qaisjp / unifdef.py
Created September 14, 2018 15:48
Python script to remove include guards from files. It also leaves files with exactly one trailing newline.
#! /usr/bin/env python3
import sys, os
def main(args):
if len(args) < 2:
print("./unifdef file1.h file2.h..")
print("Python script to remove include guards from files, and replaces with '#pragma once'.")
@qaisjp
qaisjp / schema.sql
Created July 29, 2018 17:03
quickfox schema
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.6.5
-- Dumped by pg_dump version 10.4
-- Started on 2018-07-29 18:00:35 BST
SET statement_timeout = 0;
@qaisjp
qaisjp / camera-logic.lua
Last active November 11, 2017 10:11
sort of lua for camera logic
-- Code written by Qais Patankar
-- Placed under the public domain, feel free to use this in your project
--
-- Code is also not real Lua code, it's pseudocode-ish, for easy public consumption.
--
-- This zooms out the camera if players are far apart.
-- All comments were written at time of Gist creation (2017-11-11).
local zoomAccuracy = 0.05
local maxZoom = 0.25
$(".course.sortable > tbody > tr").each((_, o) => {console.log(
$(o).children().eq(1).text(),
$(o).children().eq(2).text(),
$(o).children().eq(0).text()
)
})
lua_shared_dict calum_scores 12k;
server {
server_name calum.hgs.club;
listen 80;
default_type text;
add_header 'Access-Control-Allow-Origin' '*';
location / {
return 444;
}
# Generate a 440 Hz square waveform in Pygame by building an array of samples and play
# it for 5 seconds. Change the hard-coded 440 to another value to generate a different
# pitch.
#
# Run with the following command:
# python pygame-play-tone.py
from array import array
from time import sleep
@qaisjp
qaisjp / INF1OP_NoughtsAndCrosses.java
Created February 25, 2017 18:31
Some magnificently shite code
public class NoughtsAndCrosses {
boolean drawn;
int winner;
public NoughtsAndCrosses(int[][] board) {
// First check all columns
for (int x = 0; x < 3; x++) {
Integer winner = board[x][0];

I don't know if we've been taught the general method for De Morgan's, but I'll say it anyway:

  • NOT the whole sentence
  • NOT each item in the brackets (direct children only)
  • INVERT each AND/OR. This makes AND become OR, and vice-versa (direct children only)

When I say direct children only, I mean that if you have (A or (B and C)), you should end up with not (not A and not (B and C)) by De Morgan's.

You should NOT end up with not (not A and (not B or not C)).

Keybase proof

I hereby claim:

  • I am qaisjp on github.
  • I am qaisjp (https://keybase.io/qaisjp) on keybase.
  • I have a public key whose fingerprint is 5D90 87F0 7DC7 E6CB 1CE0 814A 39A7 A845 3517 B0FD

To claim this, I am signing this object:

@qaisjp
qaisjp / tut2 ex4.hs
Last active October 9, 2016 14:58 — forked from Fasand/tut2 ex4
lookUp :: Char -> [(Char, Char)] -> Char
lookUp needle xs = if (null selected) then needle else snd $ selected !! 0
where
selected = [x | x <- xs, fst x == needle]