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/bash | |
# https://stackoverflow.com/a/48779000 | |
# https://dev.to/nathannosudo/bash-script-to-send-a-message-in-telegram-from-your-terminal-20c7 | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: API_TOKEN=123 CHAT_ID=456 teletail /var/log/test.log" | |
exit 0 | |
fi |
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/bash | |
dir=s1 | |
out=out | |
mkdir -p $out/$dir | |
re='^[0-9]+$' | |
for filename in $dir/*; do |
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/bash | |
set -e | |
TAG=imgproxy-builder | |
docker build -t $TAG - << EOF | |
FROM golang:latest | |
RUN apt update && apt install -y libvips-dev | |
WORKDIR /src | |
RUN git clone https://github.com/imgproxy/imgproxy.git |
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
document.querySelectorAll('.comment').forEach(el => { | |
const score = parseInt(el.querySelector('.voting-wjt__counter').innerText.replace('–', '-')); | |
if (Math.abs(score) < 2) { | |
el.remove(); | |
} | |
}); |
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
import React, { createContext, useContext, useState } from 'react'; | |
import PropTypes from 'prop-types'; | |
import en from './en'; | |
const TranslationContext = createContext(); | |
export const useTranslation = () => useContext(TranslationContext); | |
const data = { |
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
<?php | |
function dd() | |
{ | |
echo('<pre>'); | |
call_user_func_array('var_dump', func_get_args()); | |
exit(); | |
} | |
require_once '../vendor/autoload.php'; |
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/bash | |
DB_HOST=... | |
if [[ $1 == --tunnel ]] || [[ $1 == -T ]]; then | |
ssh -NL 3306:127.0.0.1:3306 $DB_HOST & | |
PID=$! | |
echo "ssh pid: $PID" | |
fi |
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 | |
ffmpeg -y -i source.mp4 -vf fps=5,scale=480:-1:flags=lanczos,palettegen palette.png | |
ffmpeg -i source.mp4 -i palette.png -filter_complex "fps=5,scale=480:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif |
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/bash | |
for i in *.flac ; do | |
ffmpeg -i "$i" -acodec libmp3lame -ab 256k -y "$(basename "${i/.flac}").mp3" | |
sleep 1 | |
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
import re | |
with open("games.log", "r") as myfile: | |
data = myfile.read() | |
results = {} | |
players = {} | |
for time, score, ping, name in re.findall('(\d+:\d+)\s+score:\s+([-\d]+)\s+ping:\s+(\d+)\s+client:\s+\d+\s+(.*)', data): | |
if not time in results: |
NewerOlder