Skip to content

Instantly share code, notes, and snippets.

View maufirf's full-sized avatar

maufirf maufirf

View GitHub Profile
@maximlt
maximlt / run_python_script_in_conda_env.bat
Last active April 1, 2024 06:23
Run a Python script in a conda environment from a batch file
@echo OFF
rem How to run a Python script in a given conda environment from a batch file.
rem It doesn't require:
rem - conda to be in the PATH
rem - cmd.exe to be initialized with conda init
rem Define here the path to your conda installation
set CONDAPATH=C:\ProgramData\Miniconda3
rem Define here the name of the environment
//10x programmers (this shitpost took a fucking hour, wtf):
const rl = require('readline').createInterface({
input: process.stdin, output: process.stdout
});
let table = {};
const q = (prompt, key) => () => new Promise(res => rl.question(prompt, answer => res(Object.assign(table, { [key]: answer })) ));
Promise.resolve()
.then(q('what is your name?', 'name'))
@himmelmaus
himmelmaus / thanos_sort.py
Created March 25, 2019 01:20
A quick implementation of the thanos sort algorithm, removing half of the array's elements at a time until the array is sorted
from random import randint
def thanos_sort(array):
while not is_sorted(array):
target_length = int(len(array)/2)
while len(array) > target_length:
del array[randint(0, len(array)-1)]
return array
def is_sorted(array):
@Bluscream
Bluscream / obs_twitch_chat.css
Last active May 22, 2024 00:41
Twitch chat transparent popout for OBS
/*
Twitch chat browsersource CSS for OBS
Original by twitch.tv/starvingpoet modified by github.com/Bluscream
Just set the URL as either one of
- https://www.twitch.tv/%%TWITCHCHANNEL%%/chat?popout=true
- https://www.twitch.tv/popout/%%TWITCHCHANNEL%%/chat
- https://www.twitch.tv/embed/%%TWITCHCHANNEL%%/chat?parent=localhost
And paste this entire file into the CSS box or paste direct import css like
@Uberi
Uberi / image_plot.py
Created November 13, 2014 02:32
Scatter plot the RGB values of an image in 3D! Requires Pillow and matplotlib, running on Python 3.
image_path = "HOPE.png"
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import pyplot
from PIL import Image
fig = pyplot.figure()
axis = fig.add_subplot(1, 1, 1, projection="3d") # 3D plot with scalar values in each axis
im = Image.open(image_path)
@jonschlinkert
jonschlinkert / markdown-cheatsheet.md
Last active April 11, 2024 04:45
A better markdown cheatsheet.
@bazub
bazub / gist:3877971
Created October 12, 2012 08:17
Grayscale/Binary images using PIL
im=Image.open("1.jpg")
#im=im.rotate(1)
im.save("e.jpg")
im2=im.convert("L")
im2.save("b.jpg")
threshold = 100
im = im2.point(lambda p: p > threshold and 255)
im.save("d.jpg")
img="d.jpg"
result = tesseract.ProcessPagesWrapper(img,api)
@sabarasaba
sabarasaba / gist:3080590
Created July 10, 2012 02:19
Remove directory from remote repository after adding them to .gitignore
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master