Skip to content

Instantly share code, notes, and snippets.

View im7mortal's full-sized avatar
👨‍💻
Available for hire

Petr im7mortal

👨‍💻
Available for hire
View GitHub Profile
@im7mortal
im7mortal / install_gpu_docker.sh
Created July 21, 2017 00:21
Install docker and nvidia-docker
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
@im7mortal
im7mortal / slack_delete.py
Created November 17, 2016 23:13 — forked from jackcarter/slack_delete.py
Delete Slack files older than 30 days. Rewrite of https://gist.github.com/jamescmartinez/909401b19c0f779fc9c1
import requests
import time
import json
token = ''
#Delete files older than this:
ts_to = int(time.time()) - 30 * 24 * 60 * 60
def list_files():
$(':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);
package main
import (
"log"
"net/http"
"os"
"database/sql"
_ "github.com/lib/pq"
"fmt"
"encoding/json"
@im7mortal
im7mortal / http_get.go
Created September 25, 2015 05:02 — forked from ijt/http_get.go
Example of using http.Get in go (golang)
package main
import (
"fmt"
"http"
"io/ioutil"
"os"
)
func main() {
alias lol='(cd /home/peter/tools/WebStorm-141.1550/bin/ && ./webstorm.sh &) && (cd /home/peter/tools/smartgit/bin/ && ./smartgit.sh &) && fg'
#!/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
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;
}
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;
}