Skip to content

Instantly share code, notes, and snippets.

View arkag's full-sized avatar

Alexander Kagno arkag

  • Denver, CO, USA
View GitHub Profile
import os
import os.path
def new():
print("This is your new game.")
os.makedirs('sav', exist_ok=True)
i = 0
name = 'save*.cwr'
for i in ['*' for name in os.listdir('sav') if os.path.isfile(name)]:
i+=1
@arkag
arkag / primes.py
Created November 6, 2015 03:32
It finds prime numbers...
num = int(input("How many primes would you like?\n"))
n = 0
p = 0
primes = [ ]
while p < num:
if(n % 2 != 0 and n % 3 != 0 and n % 4 != 0 and n % 5 != 0):
primes.append(n)
p+=1
n+=1
@arkag
arkag / rpsLogic.py
Created November 8, 2015 05:54
Logic for Rock Paper Scissors
import random
weapons = ["Rock", "Paper", "Scissors", "rock", "paper", "scissors"]
players = ["computer", "Computer", "human", "Human"]
rock = ["Rock", "rock"]
paper = ["Paper", "paper"]
scissors = ["Scissors", "scissors"]
res = ""
@arkag
arkag / detection
Last active November 9, 2015 18:42
if text.startswith("@U0E4887DF"):
tasks[user].append(text[8:])
outputs.append([channel, "added"])
@arkag
arkag / Todo.py
Last active November 9, 2015 20:36
Bot thing
import os
import pickle
from collections import defaultdict
outputs = []
crontabs = []
tasks = defaultdict(list)
FILE = 'plugins/todo.data'
location 10.b.l.a:h {
proxy_pass http://blah.blech.com;
}
@arkag
arkag / gist:6c8224f909bebde4949c
Created February 21, 2016 06:21
Error in ruby
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `parse': 399: unexpected token at ']' (JSON::ParserError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `parse'
from 1password2pass.rb:102:in `<main>'
@arkag
arkag / error.lua
Created February 26, 2016 03:16
Hammerspoon issue...
-- Set Function for opening my email
local function openmail()
application.launchOrFocus("CloudMagic Email")
end
-- Set prefix mode
prefix = hs.hotkey.modal.new('cmd', 'j')
function prefix:entered() hs.alert'Entered mode' end
function prefix:exited() hs.alert'Exited mode' end
prefix:bind('', 'escape', function() prefix:exit() end)
@arkag
arkag / blob.json
Created February 26, 2016 20:21
How do I get this into phabricator?
projects.custom-field-definitions
{
"my-org:ldap:dn": {
"name": "LDAP DN",
"type": "text",
"caption": "DN of the LDAP object to sync with (if any).",
"required": false,
"disabled": false,
"edit": true,
@arkag
arkag / window_gridding.lua
Created March 1, 2016 18:25
Trying to get quartering to work in Hammerspoon
local function originalarrows()
prefix:bind('', 'Left', function() leftwin(false) end)
prefix:bind('', 'Right', function() rightwin(false) end)
prefix:bind('', 'Up', function() topwin(false) end)
prefix:bind('', 'Down', function() botwin(false) end)
end
local function newarrows()
prefix:bind('', 'Left', function() leftwin(true) end)
prefix:bind('', 'Right', function() rightwin(true) end)