Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"math/rand"
"strings"
"time"
)
func main() {
@chikien276
chikien276 / build.sh
Created October 17, 2018 13:40
Nginx with minio
adduser username
usermod -aG sudo username
ufw limit 22
apt update && apt dist-upgrade -y
# install mino
rsync -avz minio.service username@minio.username.com:/home/username
# instal nginx and let's encrypt https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
sudo add-apt-repository ppa:certbot/certbot
@chikien276
chikien276 / convert.cmd
Created September 10, 2018 16:38
Convert all images in folder to better quanlity/size
FOR /R %f IN (*.jpg) DO mogrify -verbose -quality 75 "%f"
// convert mp3 to mp4 file
Measure-Command { ffmpeg -i 1.mp3 -shortest -b 1000k -acodec copy 3.mp4 }
// Crop mp4 file to ts file
Measure-Command { ffmpeg -i .\output.mp4 -c:v h264 -flags +cgop -g 30 -hls_time 1 -strict -2 -hls_playlist_type 2 2/out.m3u8 }
#include <QtCore/QCoreApplication>
#include <QDebug>
#define __STDC_CONSTANT_MACROS
#define __STDC_LIMIT_MACROS
#define UINT64_C
#define WinMain@16
#include "fcntl.h"
int f_desw;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using System.IO;
using Microsoft.AspNetCore.Hosting;
namespace VideoServing.Controllers
{
@chikien276
chikien276 / youtube.js
Created July 14, 2017 08:58
Script craw first result video on youtube
var artists=["Justin Bieber", "Justin Bieber", "Drake Featuring WizKid &amp; Kyla", "Rihanna Featuring Drake", "twenty one pilots", "Desiigner", "Adele", "The Chainsmokers Featuring Daya", "Justin Timberlake", "The Chainsmokers Featuring Halsey", "Sia Featuring Sean Paul", "Lukas Graham", "Rihanna", "Flo Rida", "Mike Posner", "Fifth Harmony Featuring Ty Dolla $ign", "Calvin Harris Featuring Rihanna", "DNCE", "G-Eazy x Bebe Rexha", "twenty one pilots", "twenty one pilots", "Zayn", "Shawn Mendes", "Drake", "Major Lazer Featuring Justin Bieber &amp; MO", "Adele", "The Chainsmokers Featuring Rozes", "Shawn Mendes", "Drake Featuring Rihanna", "Future Featuring The Weeknd", "Justin Bieber", "The Weeknd", "P!nk", "D.R.A.M. Featuring Lil Yachty", "Bryson Tiller", "Ariana Grande", "Drake &amp; Future", "gnash Featuring Olivia O'Brien", "Alessia Cara", "Selena Gomez", "Drake", "Meghan Trainor Featuring John Legend", "Charlie Puth", "James Bay", "Meghan Trainor", "Zara Larsson &amp; MNEK", "DJ Snake Featuring Justin Bie
public Task SendEmailAsync(string email, string subject, string message)
{
var msg = new MimeMessage();
msg.From.Add(new MailboxAddress(EmailConfig.From, EmailConfig.FromEmail));
msg.To.Add(new MailboxAddress("", email));
msg.Subject = subject;
var bodyBuilder = new BodyBuilder();
bodyBuilder.HtmlBody = message;
@chikien276
chikien276 / style.css
Last active March 30, 2017 21:34
Bootstrap: 100% sceen width child element inside .container with no multiple .container elements, no javascript.
.hr-div {
padding: 10px;
}
.hr-div div {
border-top: 1px solid #f68e92;
position: absolute;
width: 100vw;
left: 0;
}
@chikien276
chikien276 / MultipartFileSender.java
Created December 29, 2016 10:42
Spring Multipart File Sender
import lan.dk.podcastserver.utils.MimeTypeUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.file.Files;