Skip to content

Instantly share code, notes, and snippets.

View jishanshaikh4's full-sized avatar
🌿

Jishan Shaikh jishanshaikh4

🌿
View GitHub Profile
@jishanshaikh4
jishanshaikh4 / ex3.py
Created June 7, 2022 08:25
Exception py3
except (IDontLikeYouException, YouAreBeingMeanException) as e:
pass
@jishanshaikh4
jishanshaikh4 / wtf_python.md
Created May 31, 2022 14:00
Exploring and understanding Python through surprising snippets - Archive.
@jishanshaikh4
jishanshaikh4 / web-animations-next-lite.min.js
Created May 29, 2022 13:47
Web Animations Next lite (JS)
/*
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@jishanshaikh4
jishanshaikh4 / game.pgn
Created May 27, 2022 10:14
Standard game format as stored by lichess.org
[Event "Rated Bullet game"]
[Site "https://lichess.org/DWpef5hg"]
[Date "2022.05.26"]
[White "jishanshaikh4"]
[Black "salirbeber"]
[Result "1-0"]
[UTCDate "2022.05.26"]
[UTCTime "13:24:36"]
[WhiteElo "2155"]
[BlackElo "2212"]
@jishanshaikh4
jishanshaikh4 / upload.js
Created May 26, 2022 21:13
Upload to AWS
import React from "react";
import S3 from "react-aws-s3";
function Upload() {
const fileInput = React.useRef();
const config = {
bucketName: process.env.REACT_APP_BUCKET_NAME,
dirName: process.env.REACT_APP_DIR_NAME /* optional */,
region: process.env.REACT_APP_REGION,
@jishanshaikh4
jishanshaikh4 / ConfirmDialog.tsx
Last active May 26, 2022 21:12 — forked from lucivaldo/ConfirmDialog.tsx
Provider to provide confirmation dialog functionality globally in React applications (not tested)
import { faCheck, faTimes, faWarning } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
Box,
Button,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
Backdrop,
@jishanshaikh4
jishanshaikh4 / create_remote_github_repo.sh
Created May 26, 2022 21:03
Create remote GitHub repository: Make sure you are signed in
curl -u USER https://api.github.com/user/repos -d '{"name":"REPO"}'
# Replace USER with your GH username and REPO with your repository name
@jishanshaikh4
jishanshaikh4 / split.py
Created May 26, 2022 20:37
Splitting a big file into smaller files separated by a delimiter (py)
with open('lichessjs.pgn') as fp:
contents = fp.read()
count = 1
for content in contents.split('\n\n\n'):
file = "game{}.txt".format(count)
count = count + 1
with open(file, 'w+') as df:
df.write(content)
@jishanshaikh4
jishanshaikh4 / awk
Created May 26, 2022 13:54
Split a 12 MB text file into 12 separate text files with index (awk)
awk '{
a[NR] = $0
}
END {
for (i = 1; i in a; ++i) {
x = (i * 12 - 1) / NR + 1
sub(/\..*$/, "", x)
print a[i] > "file" x ".txt"
}
}' file.txt