Skip to content

Instantly share code, notes, and snippets.

View TunedMystic's full-sized avatar

Sandeep Jadoonanan TunedMystic

View GitHub Profile
@sjbitcode
sjbitcode / secret_santa.py
Created October 10, 2021 07:26
Secret Santa script (draft)
from itertools import permutations
from random import choice as randchoice
og_names = ['a', 'b', 'c', 'd'] # secret santa choices
names, recipients = [], []
def set_names():
global names
global recipients
@johnmanjiro13
johnmanjiro13 / main.go
Last active May 2, 2024 15:22
Draw text to image in Go
package main
import (
"bufio"
"fmt"
"image"
"image/color"
"image/draw"
"image/jpeg"
"log"
@TunedMystic
TunedMystic / links.md
Last active January 10, 2021 05:37
Hacker News: Successful one-person online businesses
@prologic
prologic / LearnGoIn5mins.md
Last active May 9, 2024 20:15
Learn Go in ~5mins
@fgshun
fgshun / zipstored.py
Last active August 17, 2021 23:45
example of using python zipfile module.
import argparse
import logging
import zipfile
from pathlib import Path
logger = logging.getLogger(__name__)
class Error(Exception):
pass
@j33ty
j33ty / print-memory.go
Created May 22, 2019 20:54
Go print current memory
package main
import (
"runtime"
"fmt"
"time"
)
func main() {
// Print our starting memory usage (should be around 0mb)
@danmakenoise
danmakenoise / test.js
Last active February 29, 2024 20:23
Unit Testing Children of React Context API Consumers with Enzyme
// Component.js
const Component = props => (
<MyContext.Consumer>
{(context) => (
<Foo
bar={props.bar}
baz={context.baz}
/>
)}
</MyContext.Consumer>
@sean-adler
sean-adler / cprofile-output.py
Created April 3, 2018 19:29
Write cProfile stats to human-readable text file
import cProfile
import pstats
prof = cProfile.Profile()
prof.run('<YOUR CODE>')
prof.sort_stats('cumtime')
prof.dump_stats('output.prof')
stream = open('output.txt', 'w')
stats = pstats.Stats('output.prof', stream=stream)
@gyli
gyli / sort_nested_dictionary.py
Last active January 8, 2024 22:07
Sort Nested Dictionary By Key in Python
# In CPython implementation of Python 3.6, dictionary keeps the insertion order.
# From Python 3.7, this will become a language feature.
# In order to sort a dictionary by key including nested dictionary inside, we can do:
def sort_dict(item: dict):
"""
Sort nested dict
Example:
Input: {'a': 1, 'c': 3, 'b': {'b2': 2, 'b1': 1}}
Output: {'a': 1, 'b': {'b1': 1, 'b2': 2}, 'c': 3}
@oliveratgithub
oliveratgithub / emojis.json
Last active May 24, 2024 08:06
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family: woman, woman, girl, girl", "shortname": ":woman_woman_girl_girl:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F467", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family: woman, woman, girl, boy", "shortname": ":woman_woman_girl_boy:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F466", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family: woman, woman, boy, boy", "shortname": ":woman_woman_boy_boy:", "unicode": "1F469 200D 1F469 200D 1F466 200D 1F466", "html": "&#128105;&zwj;&#128105;&zwj;&#128102;&zwj;&#128102;", "category": "People & Body (family)", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family: man, woman, girl, girl", "shortname": ":man_woman_girl_girl:", "unicode": "1F468 200D 1F469 200D 1F467 200D 1F467", "html": "&#128104;&zwj;&#128105;&z