Skip to content

Instantly share code, notes, and snippets.

View smileart's full-sized avatar
:octocat:
Work In Progress

Serge Bedzhyk smileart

:octocat:
Work In Progress
View GitHub Profile
@barbietunnie
barbietunnie / udemy-courses-download-using-cookies.md
Last active May 5, 2024 04:06
Downloading Udemy videos with youtube-dl

How to download your Udemy course videos using youtube-dl

$ youtube-dl --list-extractors | grep udemy

Steps

  1. Get link to the course to download. e.g. https://www.udemy.com/course-name/
  2. Login into udemy website, save the cookie from chrome using Chrome (Cookie.txt)[1] export extension. Save it to file udemy-cookies.txt
  3. Get the link of the video that you want to download. usually in format. Use the command provided below where you have to replace the {course_link} and {path_to_cookies_file} with respective paths.
$ youtube-dl {course_link} --cookies {path_to_cookies_file}
@aliuygur
aliuygur / desc.md
Last active July 22, 2022 09:48
removes duplicate values in given slice

this algorithm 10x faster than https://www.dotnetperls.com/duplicates-go and zero allocation

➜  api git:(master) ✗ go test -v -bench=. main_test.go
=== RUN   TestSliceUniq
--- PASS: TestSliceUniq (0.00s)
BenchmarkSliceUniq-4             3000000               439 ns/op               0 B/op          0 allocs/op
BenchmarkRemoveDuplicates-4       500000              4599 ns/op             571 B/op          8 allocs/op
PASS

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@inscapist
inscapist / Dockerfile
Last active April 11, 2020 08:32
Docker + Rails configuration + Docker Sync
# This Dockerfile is intended to build a production-ready app image.
#
# This is not required for development environments
FROM sagittaros/rails-base:latest
MAINTAINER Felix Tioh <felix.tioh@crowdo.com>
COPY . /app
WORKDIR /app
EXPOSE 5000
@BretFisher
BretFisher / docker-swarm-ports.md
Last active April 4, 2024 22:19
Docker Swarm Port Requirements, both Swarm Mode 1.12+ and Swarm Classic, plus AWS Security Group Style Tables

Docker Swarm Mode Ports

Starting with 1.12 in July 2016, Docker Swarm Mode is a built-in solution with built-in key/value store. Easier to get started, and fewer ports to configure.

Inbound Traffic for Swarm Management

  • TCP port 2377 for cluster management & raft sync communications
  • TCP and UDP port 7946 for "control plane" gossip discovery communication between all nodes
  • UDP port 4789 for "data plane" VXLAN overlay network traffic
  • IP Protocol 50 (ESP) if you plan on using overlay network with the encryption option

AWS Security Group Example

@mrinalwadhwa
mrinalwadhwa / utc_iso8601_milli.rb
Last active October 21, 2019 11:37
Ruby: Convert to UTC time in ISO 8601 format with millisecond precision, padding of 3.
def utc_iso8601_milli(time)
time.utc.strftime '%FT%T.%LZ'
end
utc_iso8601_milli Time.now
# => "2016-09-02T07:06:18.134Z"
utc_iso8601_milli Time.new(2002, 10, 31, 2, 2, 2, "+05:00")
# => "2002-10-30T21:02:02.000Z"
@bcomnes
bcomnes / git-gpg.md
Last active February 13, 2024 07:33
my version of gpg on the mac
  1. brew install gnupg, pinentry-mac (this includes gpg-agent and pinentry)

  2. Generate a key: $ gpg --gen-key

  3. Take the defaults. Whatevs

  4. Tell gpg-agent to use pinentry-mac:

    $ vim ~/.gnupg/gpg-agent.conf 
    
@Gowiem
Gowiem / rack_stats.rb
Created February 16, 2016 18:03
Rack Middleware for collecting Rails stats on Controller, Action, and Global response times and response code
# Heavily inspired by:
# scout_statsd_rack -- https://github.com/scoutapp/scout_statsd_rack/blob/master/lib/scout_statsd_rack.rb
# trashed -- https://github.com/basecamp/trashed
# Add to Rails App: `config.middleware.use RackStats`
class RackStats
attr_accessor :app
def initialize(app)
@app = app
end
@stephenway
stephenway / git-change-author-commit.sh
Created December 19, 2015 04:02
Change last commit author
git commit --amend --author "Stephen Way <way.stephen@gmail.com>" --no-edit && \
git rebase --continue
...
git push origin master --force
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent