Skip to content

Instantly share code, notes, and snippets.

View grudus's full-sized avatar
🦆

Kuba grudus

🦆
View GitHub Profile
@bbchui
bbchui / tic-tac-toe.js
Created February 5, 2018 10:51
tic-tac-toe eminem version
const readline = require('readline');
const reader = readline.createInterface({
input: process.stdin,
output: process.stdout
});
class LoseYourself {
constructor(oneShot = [[3,2,1],[],[]]) {
this.oneShot = oneShot;
@tobywf
tobywf / clean_old_lambda_versions.py
Last active June 10, 2024 14:15
A quick script to remove old AWS Lambda function versions
from __future__ import absolute_import, print_function, unicode_literals
import boto3
def clean_old_lambda_versions():
client = boto3.client('lambda')
functions = client.list_functions()['Functions']
for function in functions:
versions = client.list_versions_by_function(FunctionName=function['FunctionArn'])['Versions']
for version in versions:
@chinchang
chinchang / xmlToJson.js
Last active September 7, 2023 02:39
Function to convert XML to JSON
/**
* Changes XML to JSON
* Modified version from here: http://davidwalsh.name/convert-xml-json
* @param {string} xml XML DOM tree
*/
function xmlToJson(xml) {
// Create the return object
var obj = {};
if (xml.nodeType == 1) {