- Ctrl + r - search through command history
- Alt + * - expand the
*
before running - Ctrl + Alt + e - expand the variables and aliases before running
- Alt + # - turn current command into a comment and put it into history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function interpolateUrl(url, params, replaceMissing) { | |
return url.replace(/:([^\/]+)/g, (match, p1) => { | |
return params[p1] || ( replaceMissing ? '' : match ); | |
}); | |
} |
When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.
-
Raw Attribute Strings
<div my-directive="some string" another-param="another string"></div>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def thr = Thread.currentThread() | |
def build = thr?.executable | |
def env = build.getBuildVariables() | |
//def env = build.getEnvironment() | |
println env | |
def ghprbCommentBody = env.get("ghprbCommentBody") | |
println "ghprbCommentBody=$ghprbCommentBody" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import lru_cache, wraps | |
class cached_method: | |
"""Decorotor for class methods. | |
Using pythons non data descriptor protocol, creates a new `functools.lru_cache` funcion wrapper | |
on first access of a instances method to cache the methods return value. | |
""" | |
def __new__(cls, func=None, **lru_kwargs): | |
if func is None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DO $$ | |
DECLARE | |
stmt TEXT; | |
BEGIN | |
FOR stmt IN SELECT 'DROP TABLE IF EXISTS "' || tablename || '" CASCADE;' | |
from pg_tables | |
WHERE schemaname = 'public' | |
LOOP | |
EXECUTE stmt; | |
END LOOP; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for file in `cat files.txt`; | |
do | |
outfile=/tmp/`basename $file`; | |
ffmpeg -i $file -ar 8000 -ac 1 -acodec pcm_s16le -ab 128k $outfile \ | |
&& mv $outfile $file; | |
done; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy.engine import create_engine | |
from sqlalchemy.orm import sessionmaker | |
def create_engine_from_django_settings(database='default'): | |
from django.conf import settings | |
db = settings.DATABASES[database] | |
engine = db['ENGINE'].lower() | |
if 'postgresql' in engine: | |
sqlalchemy_engine = 'postgresql' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
exit_error() | |
{ | |
echo "$1" >&2 && exit 1 | |
} | |
valid_ip() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Chrome browsers cgroup | |
After=multi-user.target | |
[Service] | |
ExecStart=/bin/bash -x -c '[ -d /sys/fs/cgroup/memory/user.slice/chrome ] || /bin/mkdir /sys/fs/cgroup/memory/user.slice/chrome; chmod 766 /sys/fs/cgroup/memory/user.slice/chrome/tasks; echo "Satrting"; CHROME_MEMORY_LIMIT_IN_BYTES=${CHROME_MEMORY_LIMIT_IN_BYTES:-5368709120}; echo "${CHROME_MEMORY_LIMIT_IN_BYTES}" >/sys/fs/cgroup/memory/user.slice/chrome/memory.limit_in_bytes; echo "Setting CHROME_MEMORY_LIMIT_IN_BYTES=${CHROME_MEMORY_LIMIT_IN_BYTES}";' | |
;ExecStart=/bin/mkdir /sys/fs/cgroup/memory/user.slice/chrome | |
;ExecStop=/bin/rm /sys/fs/cgroup/memory/user.slice/chrome | |
EnvironmentFile=-/etc/environment | |
Type=oneshot |