Skip to content

Instantly share code, notes, and snippets.

View liaocs2008's full-sized avatar
🎯
Focusing

Leo liaocs2008

🎯
Focusing
View GitHub Profile
@1wErt3r
1wErt3r / SMBDIS.ASM
Created November 9, 2012 22:27
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@onauparc
onauparc / C++ Predict with caffe
Created June 17, 2014 13:36
sample code for caffe C++ prediction
#include <cuda_runtime.h>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <string>
#include <iostream>
#include <stdio.h>
#include "caffe/caffe.hpp"
@benhoyt
benhoyt / ngrams.py
Created May 12, 2016 15:34
Print most frequent N-grams in given file
"""Print most frequent N-grams in given file.
Usage: python ngrams.py filename
Problem description: Build a tool which receives a corpus of text,
analyses it and reports the top 10 most frequent bigrams, trigrams,
four-grams (i.e. most frequently occurring two, three and four word
consecutive combinations).
NOTES
@SunnyRaj
SunnyRaj / configure_muliple_gcc.sh
Last active October 10, 2023 09:17
Configure multiple GCC versions on ubuntu
#!/usr/bin/env bash
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt update
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
sudo apt-get install -y gcc-4.8 g++-4.8 gcc-4.9 g++-4.9 gcc-5 g++-5 gcc-6 g++-6 gcc-7 g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
@simonw
simonw / recover_source_code.md
Last active June 21, 2024 00:11
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@wassname
wassname / torch_summarize_with_df.py
Last active May 22, 2020 06:09
summarize a torch model like in keras, showing parameters and output shape
# summarize model
from collections import OrderedDict
import pandas as pd
import torch
from torch import nn
from torch.autograd import Variable
class TorchSummarizeDf(object):
def __init__(self, model, weights=False, input_shape=True, nb_trainable=False, debug=False):
@jinyu121
jinyu121 / README.md
Last active November 28, 2018 07:24
雅黑PHP探针 自用精简版

雅黑PHP探针 自用精简版

在原0.4.7版基础上,只保留AJAX部分,显示服务器时时信息。

声明

本版本为自用版。

版本记录

@W4ngatang
W4ngatang / download_glue_data.py
Last active May 23, 2024 12:55
Script for downloading data of the GLUE benchmark (gluebenchmark.com)
''' Script for downloading all GLUE data.
Note: for legal reasons, we are unable to host MRPC.
You can either use the version hosted by the SentEval team, which is already tokenized,
or you can download the original data from (https://download.microsoft.com/download/D/4/6/D46FF87A-F6B9-4252-AA8B-3604ED519838/MSRParaphraseCorpus.msi) and extract the data from it manually.
For Windows users, you can run the .msi file. For Mac and Linux users, consider an external library such as 'cabextract' (see below for an example).
You should then rename and place specific files in a folder (see below for an example).
mkdir MRPC
cabextract MSRParaphraseCorpus.msi -d MRPC
@popcornell
popcornell / gf2elim.py
Last active May 16, 2023 05:20
Gaussian elimination for binary matrices ( all elements in GF(2) ) implemented in numba python and numpy for efficiency.
import numpy as np
import numba
@numba.jit(nopython=True, parallel=True) #parallel speeds up computation only over very large matrices
# M is a mxn matrix binary matrix
# all elements in M should be uint8
def gf2elim(M):
m,n = M.shape
@Windsooon
Windsooon / leetcode_retag.md
Last active July 17, 2024 13:30
Retag most popular Leetcode problems

osjobs

海外兔

website