Skip to content

Instantly share code, notes, and snippets.

View jmkim's full-sized avatar

Jongmin Kim jmkim

View GitHub Profile
@wzjoriv
wzjoriv / clustering.py
Last active August 11, 2024 20:47
Nearest Neighbor, K Nearest Neighbor and K Means (NN, KNN, KMeans) implemented only using PyTorch
import torch as th
"""
Author: Josue N Rivera (github.com/wzjoriv)
Date: 7/3/2021
Description: Snippet of various clustering implementations only using PyTorch
Full project repository: https://github.com/wzjoriv/Lign (A graph deep learning framework that works alongside PyTorch)
"""
def random_sample(tensor, k):
@scientificRat
scientificRat / keymap.py
Last active April 7, 2025 08:57
Use raspberry pi as Bluetooth HID mouse/keyboard emulator
#
# Taken from https://www.gadgetdaily.xyz/create-a-cool-sliding-and-scrollable-mobile-menu/
#
# Convert value returned from Linux event device ("evdev") to a HID code. This
# is reverse of what's actually hardcoded in the kernel.
#
# Lubomir Rintel <[email protected]>
# License: GPL
#
# Ported to a Python module by Liam Fraser.
@MatheusRich
MatheusRich / final-evaluation.md
Last active September 3, 2019 18:37
Google Summer of Code 2019 Work Product Submission

Google Summer of Code 2019 Report

Integrate functionality from gem-web into RubyGems gem CLI

[Gem-web][gem-web] is a tool that capable of providing an interface that allows opening documentation, source code, and website of a ruby gem. My goal on GSoC was integrating it on RubyGems' CLI, which would make this feature available out of the box to all ruby users, improving their productivity, since there would have no need to search this information manually.

My Planning

@hardillb
hardillb / rebootGW.js
Created August 14, 2019 16:22
code to reboot a Ikea Tradfri gateway
const trad = require('node-tradfri-client');
const TradfriClient = trad.TradfriClient;
const psk = "the psk stored in the QR code on bottom of GW";
const ip = "IP address of GW"; // you find this with avahi
const client = new TradfriClient(ip);
//console.log(client);
client.authenticate(psk).then( (creds) => {
@Akrabut
Akrabut / GSoC2019.md
Last active July 27, 2021 11:49
Google Summer of Code 2019 Summary (Ruby Language)

Summer of Code

Ruby Bundler and gem metrics, statistics, and analytics

Goals and Achievements

Project Goal

To have Bundler report anonymous usage metrics over HTTP to rubygems.org when a heavy command is run (to avoid deteriorating the runtime), and to have a backend API endpoint in rubygems.org to instrument it.

Did we achieve the goal?

Basically, yes. The actual implementation changed a little bit, and we decided to only instrument the low cardinality metrics using Datadog, as the free Datadog version limits value cardinality and wouldn't work with, for example, time related metrics.

@jmkim
jmkim / logcombiner.sh
Created June 18, 2018 01:36
Log combiner for logrotate
#!/bin/bash
for a in $(ls -1 access* | sort -t. -k3,3nr)
do
cat "$a" >> combined_access.log
done
for e in $(ls -1 error* | sort -t. -k3,3nr)
do
cat "$e" >> combined_error.log
@srnghn
srnghn / ANOVA_Spark_2.0.py
Created October 20, 2016 23:16
ANOVA Test for Spark 2.0 using PySpark. The function returns 5 values: degrees of freedom between (numerator), degrees of freedom within (denominator), F-value, eta squared and omega squared.
from pyspark.sql.functions import *
# Implementation of ANOVA function: calculates the degrees of freedom, F-value, eta squared and omega squared values.
# Expects that 'categoryData' with two columns, the first being the categorical independent variable and the second being the scale dependent variable
def getAnovaStats(categoryData) :
cat_val = categoryData.toDF("cat","value")
cat_val.createOrReplaceTempView("df")
newdf = spark.sql("select A.cat, A.value, cast((A.value * A.value) as double) as valueSq, ((A.value - B.avg) * (A.value - B.avg)) as diffSq from df A join (select cat, avg(value) as avg from df group by cat) B where A.cat = B.cat")
grouped = newdf.groupBy("cat")
#!/bin/bash
# This script will create you CA-signed client certificate.
#
# First, please follow these steps:
# - Create the root pair
# - Create the intermediate pair
# in https://jamielinux.com/docs/openssl-certificate-authority/
#
# Second, this script will NOT use attributes defined in your
# `openssl.cnf'. Define your C, ST, and O to the head of this
@whophil
whophil / jupyter.service
Last active October 8, 2024 00:42 — forked from doowon/jupyter_systemd
A systemd script for running a Jupyter notebook server.
# After Ubuntu 16.04, Systemd becomes the default.
# It is simpler than https://gist.github.com/Doowon/38910829898a6624ce4ed554f082c4dd
[Unit]
Description=Jupyter Notebook
[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=/home/phil/Enthought/Canopy_64bit/User/bin/jupyter-notebook --config=/home/phil/.jupyter/jupyter_notebook_config.py
@jmkim
jmkim / chmodbatch.sh
Last active October 5, 2016 06:47
Batch change the mode bit (the permission of files and directories)
#!/bin/bash
# Batch change the mode bit (the permission of files and directories)
#
# USAGE: script_name [path1] [path2]...
# script_name
#
# Author: Jongmin Kim ([email protected])