Skip to content

Instantly share code, notes, and snippets.

View awgeezrick's full-sized avatar

Mark Jones awgeezrick

View GitHub Profile
@mikowl
mikowl / oneliners.js
Last active September 24, 2025 19:23
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
@jcmgray
jcmgray / compare_pip_and_conda_packages.py
Last active March 12, 2019 01:10
List: (a) pip installed packages that can be found on conda, (b) pip-only installed packages that are outdated.
#!/usr/bin/env python
import subprocess
print("Finding packages conda says are installed by pip...")
conda_raw = subprocess.run(
['conda', 'list'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
).stdout.decode('utf-8')
@ItsMeThom-zz
ItsMeThom-zz / sudoku.py
Created February 15, 2019 16:34
Experiments with sudoku validation (Mostly playing with list comprehensions and generators)
board = [
[1,2,3,4,5,6,7,8,9],
[5,7,8,1,3,9,6,2,4],
[4,9,6,8,7,2,1,5,3],
[9,5,2,3,8,1,4,6,7],
[6,4,1,2,9,7,8,3,5],
[3,8,7,5,6,4,2,9,1],
[7,1,9,6,2,3,5,4,8],
[8,6,4,9,1,5,3,7,2],
[2,3,5,7,4,8,9,1,6]
// MIT License
//
// Copyright (c) 2019 xarantolus
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@scw
scw / navigator fix
Last active September 20, 2019 17:01
Patch Anaconda Navigator to use conda executable instead of root python wrapper to conda
# NOTE: activate the environment containing Pro + Anaconda Navigator, and copy the
# navigator-pro.patch to your working directory.
conda install -y m2-patch
patch --binary %CONDA_PREFIX%\Lib\site-packages\anaconda_navigator\api\conda_api.py navigator-pro.patch
@den-run-ai
den-run-ai / performace_list_set_diff.ipynb
Last active April 20, 2022 14:42
Get difference between two lists
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Spindel
Spindel / model.py
Last active March 22, 2023 01:19
Interview question model.
import uuid
import random
from afase.models.meta import Base
from sqlalchemy import (
Column,
Text,
Date,
ForeignKey,
@spences10
spences10 / github-cheat-sheet.md
Last active November 18, 2024 21:37
GitHub Cheat Sheet

Useful Git commands

This is just stuff that I have put down that I find I use a lot of the time for my own reference.

Latest changes from repo to your machine

$ git pull
# -*- coding: utf-8 -*-
import click
import os
import pandas as pd
def file_split(file):
s = file.split('.')
name = '.'.join(s[:-1]) # get directory name
@d-wasserman
d-wasserman / FeatureTabletoDataframe.py
Last active October 18, 2024 20:23
Functions to convert a ArcGIS Table/Feature Class in arcpy to a pandas dataframe. For other options, check the new ArcGIS Python API, but this works across versions.
import arcpy
import pandas as pd
def arcgis_table_to_df(in_fc, input_fields=None, query=""):
"""Function will convert an arcgis table into a pandas dataframe with an object ID index, and the selected
input fields using an arcpy.da.SearchCursor.
:param - in_fc - input feature class or table to convert
:param - input_fields - fields to input to a da search cursor for retrieval
:param - query - sql query to grab appropriate values
:returns - pandas.DataFrame"""