function grep_git_history() {
local term="${@}"
git grep -e "${term}" $(git log -S "${term}" --pretty=format:"%H")
}
grep_git_history 'var = 1'
grep_git_history '{% url'
To create the service file.
sudo vim /etc/systemd/system/webapp.service
sudo systemctl daemon-reload
sudo systemctl enable webapp.service
sudo systemctl start webapp
sudo systemctl restart webapp
If your webapp creates a unix socket, you could fix permissions by using a .path unit observer.
""" | |
MIT License | |
Copyright (c) 2017 Michał Bultrowicz | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
import { Pipe, PipeTransform, NgZone } from '@angular/core'; | |
import { Observable } from 'rxjs/Observable'; | |
import { ImageSource, fromResource } from 'image-source'; | |
import { Cache } from 'ui/image-cache'; | |
import { isFileOrResourcePath, isDataURI } from 'utils/utils'; | |
let cache = new Cache(); | |
cache.placeholder = fromResource('placeholder'); |
Streaming your Linux desktop to Youtube and Twitch via Nvidia's NVENC and VAAPI:
Considerations to take when live streaming:
The following best practice observations apply when using a hardware-based encoder for live streaming to any platform:
-
Set the buffer size (
-bufsize:v
) equal to the target bitrate (-b:v
). You want to ensure that you're encoding in CBR mode. -
Set up the encoders as shown:
I got this idea about using deploy scripts in the same way developer use ansible playbooks. I know is far from ideal, but I was able to make it work for my personal use.
So, the basics: Send a directory, execute a script in it, remove the directory when done.
For the future:
- apt utils
- service utils
from django.core.management.base import BaseCommand | |
from django.db.models import get_models, get_app, fields | |
from django.db.models.fields import related | |
class Command(BaseCommand): | |
help = """Generate factory-boy factories for the given app""" | |
def handle(self, *args, **options): | |
assert len(args) == 1, 'Must specify app name as first and only argument' |
Caching http://registry.npmjs.org/ aggressively with squid
We run a lot of project in our automated test environment and they spend a lot of time doing npm install
.
One way to speed up npm install
and hammer the registry a little less is to use the http-version of the registry and to pass the requests through a proxy.
However, the npm requests include an authorization
-header and the responses come with an ETag
and Cache-Control: max-age=60
, so with default squid settings there is a lot of roundtrips to registry.npmjs.org that result in 304's.
This is what the requests look like once npm has cached the first set of responses:
GET http://registry.npmjs.org/sntp HTTP/1.1
#!/bin/bash | |
# Download it. | |
# Name it as 'theme' | |
# Place it in /usr/bin/ | |
# shell_prompt$ theme | |
echo ' | |
3024 Day ( 1) 3024 Night ( 2) AdventureTime ( 3) | |
Afterglow ( 4) AlienBlood ( 5) Argonaut ( 6) | |
Arthur ( 7) Atom ( 8) Belafonte Day ( 9) | |
Belafonte Night ( 10) BirdsOfParadise ( 11) Blazer ( 12) |