Skip to content

Instantly share code, notes, and snippets.

@bessarabov
bessarabov / gist:674ea13c77fc8128f24b5e3f53b7f094
Last active Jul 19, 2019
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
View gist:674ea13c77fc8128f24b5e3f53b7f094
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@amatellanes
amatellanes / celery.sh
Last active Jul 19, 2019
Celery handy commands
View celery.sh
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),
View material-theme.terminal
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGKSpYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKcHCBMXGyImVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T
Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPECgwLjAyNzQ1MTAw
NjcgMC4yMTE3NjQ3MjMxIDAuMjU4ODIzNDg0MiAxTxAoMC4wMzkzODA3NDc4MiAwLjE2
@bradtraversy
bradtraversy / docker-help.md
Last active Jul 19, 2019
Docker Commands, Help & Tips
View docker-help.md

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@yatemmma
yatemmma / git-lesson.md
Last active Jul 19, 2019
git初心者への道 - お仕事で困らないレベルまでググっとします。
View git-lesson.md

git初心者への道

Level 1

まずやってみよう - コミットする、ログを見る、差分を見る

初登場するコマンド: init, add, commit, log, config, status, diff

Level 2

@joshnuss
joshnuss / app.js
Last active Jul 19, 2019
Express.js role-based permissions middleware
View app.js
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@fwyzard
fwyzard / xavier-lxc-centos7.md
Last active Jul 19, 2019
Install CentOS 7 in an LXC/LXD container on an NVIDIA Xavier
View xavier-lxc-centos7.md

Install and configure LXD

Install LXD

sudo snap install lxd

Perform the initial configuration

sudo lxd init
@schickling
schickling / UIImageFixedOrientationExtension.swift
Last active Jul 19, 2019
Extension to fix orientation of an UIImage (Sets orientation to portrait)
View UIImageFixedOrientationExtension.swift
extension UIImage {
func fixedOrientation() -> UIImage {
if imageOrientation == UIImageOrientation.Up {
return self
}
var transform: CGAffineTransform = CGAffineTransformIdentity
@ryanlecompte
ryanlecompte / gist:1283413
Created Oct 13, 2011
Providing an ActiveRecord-like before_filter capability to arbitrary Ruby classes
View gist:1283413
# First the end result of what we want:
class Foo
before_hook :whoa
before_hook :amazing
def test
puts "This is kinda cool!"
end
@mari-linhares
mari-linhares / msi-gtx1060-ubuntu-18.04-deeplearning.md
Last active Jul 19, 2019
Setting up a MSI laptop with GPU (gtx1060), Installing Ubuntu 18.04, CUDA, CDNN, Pytorch and TensorFlow
View msi-gtx1060-ubuntu-18.04-deeplearning.md
You can’t perform that action at this time.