Skip to content

Instantly share code, notes, and snippets.

View system123's full-sized avatar

Lloyd Hughes system123

View GitHub Profile
@RogerWebb
RogerWebb / bigchalice.py
Created February 2, 2023 21:29
Deploy AWS Chalice Project via Docker and Serverless Application Model
import boto3, json, os, shutil, subprocess
from argparse import ArgumentParser
"""
Big Chalice Deployer deployes Chalice Apps using the "chalice package ..." command and
modifies the resulting sam.json template to make use of the Docker deployment process
instead of the default, s3 based, process. Additionally, the ability to delete the
resulting SAM App is available via the CLI.
Usage:
@Shaunakde
Shaunakde / fast-rsync.md
Created November 30, 2020 21:21
Fast rsync from mac to linux

This set of parameters experimentally seems to work the best for macos to linux file transfer. This is ofcourse not secure and is intended for transferring things like machine learning datasets to a workstation from a laptop etc.

Command

rsync -rltv --progress --human-readable --delete -e 'ssh -T -c aes128-gcm@openssh.com -o Compression=no -x'

Explaination

  • r: Recursive. Allow directories to be traversed and copied.
@mrkpatchaa
mrkpatchaa / README.md
Last active April 4, 2024 09:37
Bulk delete github repos

Use this trick to bulk delete your old repos or old forks

(Inspired by https://medium.com/@icanhazedit/clean-up-unused-github-rpositories-c2549294ee45#.3hwv4nxv5)

  1. Open in a new tab all to-be-deleted github repositores (Use the mouse’s middle click or Ctrl + Click) https://github.com/username?tab=repositories

  2. Use one tab https://chrome.google.com/webstore/detail/onetab/chphlpgkkbolifaimnlloiipkdnihall to shorten them to a list.

  3. Save that list to some path

  4. The list should be in the form of “ur_username\repo_name” per line. Use regex search (Sublime text could help). Search for ' |.*' and replace by empty.

@al42and
al42and / kittler.py
Created January 19, 2016 16:07
Kittler-Illingworth Thresholding
import numpy as np
def Kittler(im, out):
"""
The reimplementation of Kittler-Illingworth Thresholding algorithm by Bob Pepin
Works on 8-bit images only
Original Matlab code: https://www.mathworks.com/matlabcentral/fileexchange/45685-kittler-illingworth-thresholding
Paper: Kittler, J. & Illingworth, J. Minimum error thresholding. Pattern Recognit. 19, 41–47 (1986).
"""
h,g = np.histogram(im.ravel(),256,[0,256])
@wanghailei
wanghailei / csallseeingeye.py
Last active February 17, 2024 21:27
Code snippets of All Seeing Eye
# The following code and the code generated art works are the intellectrual properities of Hailei Wang.
# © 2009 - 2014, Hailei Wang. All rights reserved.
from nodebox import geo
colors = ximport("colors")
# Define Brush
def composeimage( x, y, colr, radius, points, diminish ) :
nofill()
stroke()
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 16, 2024 23:05
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@kachayev
kachayev / dijkstra.py
Last active April 14, 2024 06:58
Dijkstra shortest path algorithm based on python heapq heap implementation
from collections import defaultdict
from heapq import *
def dijkstra(edges, f, t):
g = defaultdict(list)
for l,r,c in edges:
g[l].append((c,r))
q, seen, mins = [(0,f,())], set(), {f: 0}
while q:
# app/controllers/custom_devise/password_controller.rb
class CustomDevise::PasswordsController < Devise::PasswordsController
def resource_params
params.require(resource_name).permit(:email, :password, :password_confirmation)
end
private :resource_params
end
@kazpsp
kazpsp / passwords_controller.rb
Created August 14, 2012 16:40 — forked from guilleiguaran/passwords_controller.rb
StrongParameters with Devise
# app/controllers/users/password_controller.rb
class Users::PasswordsController < Devise::PasswordsController
def resource_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
private :resource_params
end