Skip to content

Instantly share code, notes, and snippets.

Utkarsh Upadhyay musically-ut

Block or report user

Report or block musically-ut

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jnothman
jnothman / bench_semi_supervised_n_iter
Created Jul 5, 2017
Benchmarking `sklearn.semi_supervised` `n_iter_` as a function of model and data characteristics
View bench_semi_supervised_n_iter
import numpy as np
from sklearn import datasets
from sklearn.semi_supervised import LabelPropagation, LabelSpreading
###for n_samples in [20, 200, 2000, 20000]:
### X, y = datasets.make_classification(n_samples=n_samples, n_classes=3, n_informative=3)
for (X, y) in [datasets.load_iris(return_X_y=True)]:
for model in [LabelPropagation(max_iter=1000),
#LabelSpreading(alpha=0.01),
#LabelSpreading(alpha=0.1),
#LabelSpreading(alpha=0.3)
@musically-ut
musically-ut / update_server.sh
Created Mar 16, 2017
Setting up a new server by copying config files from local computer.
View update_server.sh
#!/bin/bash
set -e
set -u
set -o pipefail
if [ -z $1 ]
then
echo "Usage: $0 [user@]servername"
exit 1
@musically-ut
musically-ut / poor_man_parallel.sh
Last active Apr 1, 2019
Poor man's parallel execution on servers
View poor_man_parallel.sh
#!/usr/bin/env bash
set -e
for N in {1..5}
do
for M in {0.1,1,2,5,10};
do
# Replace ./my_prog.py with your program to run it in parallel
./my_prog.py -N $N -M $M > output/stdout_N${N}_M${M}.txt &
@alekseykulikov
alekseykulikov / index.md
Last active Nov 12, 2019
Principles we use to write CSS for modern browsers
View index.md

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@musically-ut
musically-ut / pre-commit.no-git.sh
Last active Aug 14, 2016
Pre-commit hook to avoid committing lines with '#NO-GIT"
View pre-commit.no-git.sh
#!/bin/sh
PAT='#\s*NO(.)?GIT'
git diff --cached --name-only | \
xargs egrep -i --color --with-filename -n "$PAT" && echo "Found '"$PAT"' in code about to be committed. Rejecting commit." && exit 1
# Exit with error code zero if all went well.
exit 0
View classifier_from_little_data_script_2.py
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@jiahao
jiahao / nrules.svg
Last active Nov 14, 2016
What do .gitignore files tell us about the inherent complexity of programming languages? This gist can be run on data from GitHub's own collection of gitignore templates, whose repository is at https://github.com/github/gitignore, and counts how many rules are present in the template for each programming language.
View nrules.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Isaddo
Isaddo / import-github-labels.js
Last active Sep 8, 2019
import github labels via console command
View import-github-labels.js
/*
Go on your labels page (https://github.com/user/repo/labels)
Edit the following label array
or
Use this snippet to export github labels (https://gist.github.com/MoOx/93c2853fee760f42d97f)
and replace it
Paste this script in your console
Press Enter!!
View broadcast.md

Broadcast Code Readme

This project is Python2-compatible and have issues while running with python 3. So please use Python2 (We used Anaconda's CPython distribution, maybe PyPy would be faster, but I don't even know whether it's OK to move to PyPy)

1. Data Access

All data access related classes are in data package. We suppose there are two SQLite databases, namely db.sqlite3 and links.sqlite3 which are stored on shared memory (/dev/shm) for faster access (they should be copied, in case of vanishing). First DB, holds tweets table with following schema:

CREATE TABLE tweets (user_id integer, tweet_time integer);
@musically-ut
musically-ut / nngraph_plot_in_itorch.lua
Last active Apr 5, 2016
How to show an nnGraph plot in iTorch
View nngraph_plot_in_itorch.lua
require 'graph';
require 'os';
function displayGraph(g, forward)
local imgFile = os.tmpname() .. '.png'
local dag = g.fg
if forward == false then
dag = g.bg
end
You can’t perform that action at this time.