Skip to content

Instantly share code, notes, and snippets.

View southpolemonkey's full-sized avatar
🎯
Focusing

southpolemonkey

🎯
Focusing
View GitHub Profile
@southpolemonkey
southpolemonkey / barchart.py
Created December 9, 2019 11:23
Create multiple columns barchart
import numpy as np
import matplotlib.pyplot as plt
# data to plot
n_groups = 4
means_frank = (90, 55, 40, 65)
means_guido = (85, 62, 54, 20)
# create plot
fig, ax = plt.subplots()
@southpolemonkey
southpolemonkey / async_await.py
Created December 4, 2019 04:38
async-await example
import asyncio
from dask.distributed import Client
def inc(x: int) -> int:
return x + 1
async def f():
async with Client(asynchronous=True) as client:
@southpolemonkey
southpolemonkey / multiple_barchart.py
Created December 4, 2019 04:01
matplotlib - two bar charts
import numpy as np
import matplotlib.pyplot as plt
# data to plot
n_groups = 4
means_frank = (90, 55, 40, 65)
means_guido = (85, 62, 54, 20)
# create plot
fig, ax = plt.subplots()
@southpolemonkey
southpolemonkey / bulk_rename_file.py
Last active May 17, 2019 03:54
bulk filename rename
import os
import glob
i = 0
for file in glob.glob('<filepattern>'):
new_filename = 'example_' + str(i) + '.txt'
os.rename(file, new_filename)
# placeholder: filepattern
@southpolemonkey
southpolemonkey / say_work.sh
Created May 5, 2019 12:23
bash function which utilise text-to-speech command to pronounce english vocabulary, with customer file and rate
#!/usr/bin/env bash
pronounce_word () {
declare -a myArray
# echo "$args"
# myArray=(`cat "$args"`)
myArray=(`cat $dir`)
say "test begin[[slnc 2000]]"
/* Merge sort in C */
#include<stdio.h>
#include<stdlib.h>
// Function to Merge Arrays L and R into A.
// lefCount = number of elements in L
// rightCount = number of elements in R.
void Merge(int *A,int *L,int leftCount,int *R,int rightCount) {
int i,j,k;