Skip to content

Instantly share code, notes, and snippets.

View allenyllee's full-sized avatar

Allen.YL allenyllee

View GitHub Profile
@allenyllee
allenyllee / pandas-to-excel.py
Created December 18, 2020 10:50 — forked from ojdo/pandas-to-excel.py
From Pandas to Excel using Openpyxl
import pandas as pd
from io import StringIO
from openpyxl.formatting.rule import ColorScaleRule
from openpyxl.styles import Alignment, Font, NamedStyle
from openpyxl.utils import get_column_letter
df = pd.read_csv(StringIO("""\
alpha beta gamma
2000-01-01 -0.173215 0.119209 -1.044236
2000-01-02 -0.861849 -2.104569 -0.494929
@allenyllee
allenyllee / defaultdict.py
Last active November 27, 2019 10:46 — forked from ohe/defaultdict.py
emulation of collections.defaultdict
"""
emulation of collections.defaultdict
"""
class defaultdict(dict):
"""
emulation of collections.defaultdict
to test, run python defaultdict.py -v
>>> dd = defaultdict(list)
@allenyllee
allenyllee / dynupdate.sh
Last active September 2, 2018 13:38 — forked from kylegibson/dynupdate.sh
Simple bash script to update a dyndns host entry
#!/bin/bash
HOST=foo.example.com
USER=
PASS=
IPADDR=$(curl -s https://api.ipify.org)
RESULT=$(wget -q -O- "https://$USER:$PASS@members.dyndns.org/nic/update?hostname=$HOST&myip=$IPADDR&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG")
@allenyllee
allenyllee / uuid.sh
Created January 12, 2018 14:57 — forked from markusfisch/uuid.sh
Generate a random UUID in bash
#!/usr/bin/env bash
# Generate a pseudo UUID
uuid()
{
local N B C='89ab'
for (( N=0; N < 16; ++N ))
do
B=$(( $RANDOM%256 ))
@allenyllee
allenyllee / Convolutional Arithmetic.ipynb
Created December 21, 2017 08:18 — forked from akiross/Convolutional Arithmetic.ipynb
Few experiments on how convolution and transposed convolution (deconvolution) should work in tensorflow.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@allenyllee
allenyllee / fetch_gdrive_file.sh
Last active November 10, 2017 08:03 — forked from ppetraki/fetch_gdrive_file.sh
allows you do non-interactively download large public files from gdrive
#!/bin/bash
SOURCE="$1"
if [ "${SOURCE}" == "" ]; then
echo "Must specify a source url"
exit 1
fi
DEST="$2"
#if [ "${DEST}" == "" ]; then
@allenyllee
allenyllee / thread_project2
Created October 4, 2017 14:31 — forked from ozanyildiz/thread_project2
Example of Multithreading in C
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#define M 3
#define K 2
#define N 3
#define NUM_THREADS M * N
/* Global variables for threads to share */
@allenyllee
allenyllee / FindOpenMP.cmake
Created September 30, 2017 15:55 — forked from mirkow/FindOpenMP.cmake
Modified FindOpenMP to work with Clang 3.8 under Ubuntu 14.04
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindOpenMP
# ----------
#
# Finds OpenMP support
#
# This module can be used to detect OpenMP support in a compiler. If