Skip to content

Instantly share code, notes, and snippets.

@KartikTalwar
KartikTalwar / Documentation.md
Last active February 28, 2025 10:57
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@Novakov
Novakov / gist:8055374
Created December 20, 2013 14:17
C# pipeline written using | operator - like command line
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace PipelineOperators
{
class Program
using System;
using System.Numerics; // Add a reference to System.Numerics.dll
using System.Runtime.CompilerServices;
using System.Threading;
class Program
{
static void Main()
{
Console.WriteLine(Factorial(15000));
using System;
using System.Linq;
class Program
{
static void Main()
{
if (true.Any is object) { }
if (ICloneable.Clone is object) { }
}
@munificent
munificent / gist:9749671
Last active June 23, 2022 04:04
You appear to be creating a new IDE...
You appear to be advocating a new:
[ ] cloud-hosted [ ] locally installable [ ] web-based [ ] browser-based [ ] language-agnostic
[ ] language-specific IDE. Your IDE will not succeed. Here is why it will not succeed.
You appear to believe that:
[ ] Syntax highlighting is what makes programming difficult
[ ] Garbage collection is free
[ ] Computers have infinite memory
[ ] Nobody really needs:
@floer32
floer32 / python_bind_function_as_method.py
Created February 11, 2015 01:42
Bind Python function as method
# based on: http://stackoverflow.com/questions/1015307/python-bind-an-unbound-method#comment8431145_1015405
def bind(instance, func, as_name):
""" Turn a function to a bound method on an instance
.. doctest::
>>> class Foo(object):
... def __init__(self, x, y):
... self.x = x
... self.y = y
@int128
int128 / README.md
Last active May 6, 2025 12:59
Watching build mode on Create React App

Create React App does not provide watching build mode oficially (#1070).

This script provides watching build mode for an external tool such as Chrome Extensions or Firebase app.

How to Use

Create a React app.

Put the script into scripts/watch.js.

@tsu-nera
tsu-nera / xgb_tb.py
Created March 30, 2018 16:00
xgboost visualization with tensorboard
from sklearn.datasets import load_boston
import pandas as pd
import xgboost as xgb
from tensorboard_logger import configure, log_value
from sklearn.cross_validation import train_test_split
def logspy(env):
log_value("train", env.evaluation_result_list[0][1], step=env.iteration)
@ZipFile
ZipFile / README.md
Last active May 9, 2025 17:09
Pixiv OAuth Flow

Retrieving Auth Token

  1. Run the command:

    python pixiv_auth.py login

    This will open the browser with Pixiv login page.

@EdoardoVignati
EdoardoVignati / flask_multipart_form_file_upload.py
Created July 8, 2021 09:57
Read multipart form data from Flask
from werkzeug.utils import secure_filename
from flask import Flask, render_template, request
@app.route("/my-upload-endpoint", methods=["POST"])
def my_upload_function():
if request.files.get("my-file-field-name") is None:
return render_template("my_error_page.html", an_optional_message="Error uploading file")
# Put here some other checks (security, file length etc...)
f = request.files["my-file-field-name"]
f.save(secure_filename(f.filename))