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 | |
if [ $# == 1 ] && [ $1 != "--daily" ]; then | |
declare -a databases=("$1") | |
else | |
declare -a databases=("db1 db2") | |
fi | |
for database in "${databases[@]}" | |
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
#!/Library/Frameworks/Python.framework/Versions/2.7/bin/python | |
from bs4 import BeautifulSoup | |
import urllib2, urllib | |
import re, os | |
# create a password manager | |
password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm() | |
baseurl = "http://example.com/files/" | |
user = 'foo' | |
password = 'bar' |
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 | |
if [ "$#" -ne 3 ]; then | |
echo "Usage: deploy REPO REF DIR" | |
echo "e.g. deploy /opt/git/example.git master /var/www/example.com" | |
exit | |
fi | |
REPO=$1 | |
REF=$2 |
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: |
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
#!/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 | |
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
<?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
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
document.querySelectorAll('.comment').forEach(el => { | |
const score = parseInt(el.querySelector('.voting-wjt__counter').innerText.replace('–', '-')); | |
if (Math.abs(score) < 2) { | |
el.remove(); | |
} | |
}); |
OlderNewer