Skip to content

Instantly share code, notes, and snippets.

View Irene-123's full-sized avatar
🎯
Focusing

kirti purohit Irene-123

🎯
Focusing
View GitHub Profile
@Irene-123
Irene-123 / day12part2.py
Created December 21, 2020 12:49
Advent of code day12 part 2
import math
def rotate(origin, point, angle):
# source: https://stackoverflow.com/a/34374437
ox, oy = origin
px, py = point
qx = ox + math.cos(angle) * (px - ox) - math.sin(angle) * (py - oy)
qy = oy + math.sin(angle) * (px - ox) + math.cos(angle) * (py - oy)
return int(round(qx)), int(round(qy))
@Irene-123
Irene-123 / transpose.m
Created December 23, 2020 05:06
Octave experiment
a=magic(4);
fprintf('The original matrix is:\n');
disp(a);
b=a.';
fprintf('\n');
fprintf('The transposed matrix is :\n');
disp(b)
@Irene-123
Irene-123 / quiz.py
Created December 23, 2020 13:15
ATBS
import random
capitals = {'Alabama': 'Montgomery', 'Alaska': 'Juneau', 'Arizona': 'Phoenix',
'Arkansas': 'Little Rock', 'California': 'Sacramento', 'Colorado': 'Denver',
'Connecticut': 'Hartford', 'Delaware': 'Dover', 'Florida': 'Tallahassee',
'Georgia': 'Atlanta', 'Hawaii': 'Honolulu', 'Idaho': 'Boise', 'Illinois':
'Springfield', 'Indiana': 'Indianapolis', 'Iowa': 'Des Moines', 'Kansas':
'Topeka', 'Kentucky': 'Frankfort', 'Louisiana': 'Baton Rouge', 'Maine':
'Augusta', 'Maryland': 'Annapolis', 'Massachusetts': 'Boston', 'Michigan':
'Lansing', 'Minnesota': 'Saint Paul', 'Mississippi': 'Jackson', 'Missouri':
@Irene-123
Irene-123 / regex.py
Created December 23, 2020 13:16
ATBS2
#!usr/bin/python3
import re
file=open('mad.txt')
text=file.read()
file.close()
regex=re.compile(r'(NOUN) | (ADJECTIVE) | (VERB)')
@Irene-123
Irene-123 / selective.py
Created December 23, 2020 13:17
selective copy
import shutil,os
def selectiveCopy(folder,extensions,destFolder):
folder=os.path.abspath(folder)
print(folder)
destFolder=os.path.abspath(destFolder)
print(destFolder)
print('Looking in '+ folder+ ' for files with extensions of ', ','.join(extensions))
for foldername,subfolders,filenames in os.walk(folder):
print("***",foldername, "**", subfolders , "*",filenames)
@Irene-123
Irene-123 / 1D.C
Created January 3, 2021 13:51
Dynamically allocating space for a 1D array in C
#include<stdlib.h>
#include<stdio.h>
int main(){
int n;
int *arr;
printf("\nEnter the number of elements in the array:" );
scanf("%d",&n);
arr=(int*)malloc(n*sizeof(n));
if (arr==NULL){
@Irene-123
Irene-123 / 2D.C
Created January 3, 2021 14:34
Dynamically allocating 2D array
#include<stdio.h>
#include<stdlib.h>
int main(){
int **arr;
int rows,cols;
printf("\nEnter the number of rows and columns respectively:" );
scanf("%d %d",&rows,&cols );
@Irene-123
Irene-123 / monk.py
Created January 9, 2021 02:24
MOnk and search //Error filled
n=int(input())
arr=list(map(int,input().split()))[:n]
arr.sort
q=int(input())
ques=[input().split() for i in range(q)]
for que in ques:
count=0
if que[0]=='0':
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="{{ url_for('static', filename='images/favicon.ico') }}">
<!DOCTYPE html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script>
L_NO_TOUCH = false;
L_DISABLE_3D = false;
</script>
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>