Skip to content

Instantly share code, notes, and snippets.

View wil's full-sized avatar

Wil Tan wil

View GitHub Profile
@ericdill
ericdill / render_env.py
Last active October 20, 2021 20:22
Render the dependency graph for your conda environment (needs graphviz!)
import json
import glob
import os
from os.path import join, basename
# install this with "conda install -c conda-forge python-graphviz"
import graphviz as gv
# path to your conda environment
path = os.environ.get('CONDA_PREFIX')
if path is None:
@cpq
cpq / restore_mac_trash.pl
Created January 22, 2015 10:41
MacOS: restore all files from Trash folder to their original location
#!/usr/bin/env perl
# Copyright (c) 2015 Sergey Lyubka
# All rights reserved
use Encode;
my $dir = "/Users/$ENV{USER}/.Trash";
sub read_file($) { local $/; open FD, $_[0] or die $_[0]; binmode FD; <FD>; }
@rodricios
rodricios / summarize.py
Last active November 18, 2020 17:21
Flipboard's summarization algorithm, sort of
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pip install networkx distance pattern
In Flipboard's article[1], they kindly divulge their interpretation
of the summarization technique called LexRank[2].
@syhw
syhw / dnn.py
Last active January 24, 2024 19:38
A simple deep neural network with or w/o dropout in one file.
"""
A deep neural network with or w/o dropout in one file.
License: Do What The Fuck You Want to Public License http://www.wtfpl.net/
"""
import numpy, theano, sys, math
from theano import tensor as T
from theano import shared
from theano.tensor.shared_randomstreams import RandomStreams
var gulp = require('gulp');
var browserify = require('browserify');
var notify = require('gulp-notify');
var source = require('vinyl-source-stream');
var watchify = require('watchify');
var plumber = require('gulp-plumber');
var less = require('gulp-less');
var csso = require('gulp-csso');
var watch = require('gulp-watch');
var envify = require('envify');
@amitsaha
amitsaha / ls.rst
Last active December 29, 2023 19:00
How does `ls` work?

How does ls work?

I wanted to be really able to explain to a fair amount of detail how does the program ls actually work right from the moment you type the command name and hit ENTER. What goes on in user space and and in kernel space? This is my attempt and what I have learned so far on Linux (Fedora 19, 3.x kernel).

How does the shell find the location of 'ls' ?

@andrewbranch
andrewbranch / select2-override.css
Last active October 16, 2017 14:04
Flat styling of select2.
.select2-container .select2-choice {
height: 34px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
background-color: #fff;
background-image: none;
background: #fff;
}
@stuartpb
stuartpb / glorw.txt
Created June 4, 2013 22:43
General list of reserved words
### General List of Reserved Words
### Stuart P. Bentley <stuart@testtrack4.com>, June 4, 2013
## This is a general list of words you may want to consider reserving,
## in a system where users can pick any name, in a context where the
## system may use names as well. One prominent example of a system
## where this is the case would be a site that serves pages for users,
## at their username, from the site root, like
## http://twitter.com/stuartpb . In this system, you would want to
## reserve some routes for pages that would commonly be expected to
@Bpless
Bpless / shell_plus_reloader.py
Last active June 5, 2018 11:40
Shell_Plus reloader thread
class ReloaderEventHandler(FileSystemEventHandler):
"""
Listen for changes to modules within the Django project
On change, reload the module in the Python Shell
Custom logic required to reload django models.py modules
Due to the singleton AppCache, which caches model references.
For those models files, we must clear and repopulate the AppCache
"""
def __init__(self, *args, **kwargs):
/*
* sshpubkeys (C)2012 by Jan-Piet Mens
*/
#define FUSE_USE_VERSION 25
#include <fuse.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>