Skip to content

Instantly share code, notes, and snippets.

View corenel's full-sized avatar
💭
I may be slow to respond.

Yusu Pan corenel

💭
I may be slow to respond.
View GitHub Profile
@underhilllabs
underhilllabs / git-split-subpath.bash
Created March 3, 2012 19:14
Split a subtree of a git repository into a separate repo.
#########################################################
#
# classes is a git repository with many class projects
# I want to split one of those projects into its own repo
# and I want preserve the commit history
#
# The super top-level repo is classes.git
# Within classes.git is a sub-directory "networks/project2"
# we want to create a new repository with just the history of
# "networks/project2"
@2019ncovmemory
2019ncovmemory / capture_articles.py
Created February 5, 2020 18:25
Create screenshots of articles; work for WeChat articles with lazy loading.
'''
Usage: python archive_articles.py test.csv
Input: test.csv
name url
1 url1
2 url2
.....
output:
1.png
2.png
@joshskidmore
joshskidmore / ubuntu-mate-gpd-micropc.sh
Created June 28, 2019 10:43
ubuntu-mate-gpd-micropc.sh
#!/usr/bin/env bash
# update
apt -y update
apt -y upgrade
apt -y dist-upgrade
# 5.2 mainline kernel
cd /tmp
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.2-rc6/linux-headers-5.2.0-050200rc6_5.2.0-050200rc6.201906222033_all.deb
@dusty-nv
dusty-nv / pytorch_jetson_install.sh
Last active October 21, 2021 01:28
Install procedure for pyTorch on NVIDIA Jetson TX1/TX2 with JetPack <= 3.2.1. For JetPack 4.2 and Xavier/Nano/TX2, see https://devtalk.nvidia.com/default/topic/1049071/jetson-nano/pytorch-for-jetson-nano/
#!/bin/bash
#
# EDIT: this script is outdated, please see https://forums.developer.nvidia.com/t/pytorch-for-jetson-nano-version-1-6-0-now-available
#
sudo apt-get install python-pip
# upgrade pip
pip install -U pip
pip --version
# pip 9.0.1 from /home/ubuntu/.local/lib/python2.7/site-packages (python 2.7)
@ShigekiKarita
ShigekiKarita / matrix_util.hpp
Last active November 12, 2021 12:44
Eigen serialization
#ifndef matrix_utils_hpp
#define matrix_utils_hpp
#include <vector>
#include <array>
#include <type_traits>
#include <fstream>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/xml_oarchive.hpp>
@yuq-1s
yuq-1s / imle.py
Last active February 1, 2022 09:27
[Implicit Maximum Likelihood Estimation](https://arxiv.org/abs/1809.09087) in 100 lines
import mxnet as mx
from mxnet import nd, autograd
from mxnet.gluon import nn
from mxnet.gluon.contrib.nn import Identity, Concurrent
from mxnet import gluon
import logging
def d(a, b):
return (a - b).norm()
@codeZoner
codeZoner / com.startup.plist
Last active July 22, 2022 08:12
Launch Demon Start up with Bash Script with MySQL Example
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Launch Daemon do not always have access to all the path variables
As a results, scripts will sometimes fail if the you are using path variables inside them
To enable the script to have access to all path variables, open up a terminal and type in -->
<!-- echo $PATH -->
<!-- You can opt to filter out some of the path variables which are not required by script-->
<key>EnvironmentVariables</key>
@csaki
csaki / simplehttpserver.py
Last active September 5, 2022 20:22
Simple Python Http Server with Upload and Authentication
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
__version__ = "0.1"
__all__ = ["SimpleHTTPRequestHandler"]
@chrisdhanaraj
chrisdhanaraj / osx.ahk
Last active September 16, 2022 00:02
Autohotkey script to bring OSX keybinds to Windows
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
LCtrl & Tab:: AltTab
!Tab:: Send ^{Tab}
!+Tab:: Send ^+{Tab}
^Space:: Send ^{Esc}
@blueset
blueset / Netease_LRC.py
Last active May 11, 2023 12:08
Netease LRC Downloader
import requests
import argparse
import os
import re
import json
import mutagen
import base64
from mutagen import easyid3
import sys
from Crypto.Cipher import AES