View install_gpu_docker.sh
This file contains 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
sudo apt-get update | |
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual | |
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common | |
sudo apt-key fingerprint 0EBFCD88 | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
sudo apt-get update | |
sudo apt-get install docker-ce | |
wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker_1.0.1-1_amd64.deb | |
sudo dpkg -i /tmp/nvidia-docker*.deb && rm /tmp/nvidia-docker*.deb | |
sudo apt-get install nvidia-modprobe |
View slack_delete.py
This file contains 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 requests | |
import time | |
import json | |
token = '' | |
#Delete files older than this: | |
ts_to = int(time.time()) - 30 * 24 * 60 * 60 | |
def list_files(): |
View get uploaded file information
This file contains 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
$(':file').change(function(){ | |
var file = this.files[0]; | |
var name = file.name; | |
var size = file.size; | |
var type = file.type; | |
console.log(name, size, type, file); | |
var myVideoPlayer = document.createElement('video'); | |
myVideoPlayer.src = URL.createObjectURL(file); | |
myVideoPlayer.addEventListener('loadedmetadata', function() { | |
console.log(myVideoPlayer.duration); |
View gist:67584280fb16814af2a1
This file contains 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
package main | |
import ( | |
"log" | |
"net/http" | |
"os" | |
"database/sql" | |
_ "github.com/lib/pq" | |
"fmt" | |
"encoding/json" |
View http_get.go
This file contains 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
package main | |
import ( | |
"fmt" | |
"http" | |
"io/ioutil" | |
"os" | |
) | |
func main() { |
View bash alias
This file contains 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
alias lol='(cd /home/peter/tools/WebStorm-141.1550/bin/ && ./webstorm.sh &) && (cd /home/peter/tools/smartgit/bin/ && ./smartgit.sh &) && fg' |
View gist:a39b1344436e47f29adc
This file contains 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 | |
SAVEIFS=$IFS | |
#вырезаю первые 47 секунд https://blog.dbrgn.ch/2013/1/29/cut-video-from-bash-with-ffmpeg/ | |
# IFS это сепаратор http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html | |
IFS=$(echo -en "\n\b") | |
for f in * | |
do | |
NAME=${f%\ Salman*} # separator \ Salman* | |
ffmpeg -ss 00:00:47.0 -i $f -acodec copy -vcodec copy -async 1 $NAME.mp4 | |
rm $f |
View gist:d561f03316edf31de358
This file contains 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
phoneHome = '+7(43243)2-34-43'.split(''); | |
var num, num1, flag ; | |
for(var i = 0; i < phoneHome.length + 1; i++) { | |
console.log(phoneHome.length ); | |
if(i === 7) { | |
flag = true; | |
num = phoneHome[i]; | |
phoneHome[i] = ')'; | |
continue; | |
} |
View gist:a2c869fce8475a23f84f
This file contains 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 mixer(arr){ | |
for ( var i = arr.length; i-->0; ) { | |
var t = arr[i], | |
j = Math.floor(i*Math.random()); | |
arr[i] = arr[j]; | |
arr[j] = t; | |
} | |
return arr; | |
} |