Skip to content

Instantly share code, notes, and snippets.

@johnsogg
johnsogg / tableThing.tsx
Created September 27, 2018 19:52
Typescript example of material-ui Table component
import {
createStyles,
Paper,
Table,
TableBody,
TableCell,
TableHead,
TableRow,
Theme,
withStyles,
@ookcode
ookcode / ytf_download.sh
Created June 7, 2018 06:28
袁腾飞全系列视频的mp3下载脚本
#!/bin/bash
########################################
#
# 使用youtube-dl库下载
# https://github.com/rg3/youtube-dl
#
########################################
# 腾飞五千年系列———中华文明起源
@belminf
belminf / cloudfront_distro.yaml
Created April 26, 2017 23:20
Example of an empty S3OriginConfig
AWSTemplateFormatVersion: 2010-09-09
Resources:
Bucket:
Type: 'AWS::S3::Bucket'
Properties:
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: error.html
Distro:
@wamith
wamith / mysql57 install.txt
Created November 5, 2016 22:08
Installing mysql 5.7 on centos 6
Installing mysql 5.7 on centos 6
1. download yum repo
wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
2. install yum repo
yum -y localinstall mysql57-community-release-el6-7.noarch.rpm
3. verify yum repo
yum repolist enabled | grep "mysql.*-community.*"
@jarvys
jarvys / loggers.py
Last active March 8, 2016 09:55
logging configuration for django
import os
LOGS_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'logs')
LOGGING = {
'version': 1,
'dusable_existing_loggers': True,
'formatters': {
'normal': {
'format': '%(levelname)s %(asctime)s %(module)s %(message)s'
@lukaszb
lukaszb / Hasher.java
Last active January 19, 2024 01:35
Java implementation of Django PasswordHasher
/* Example implementation of password hasher similar to Django's PasswordHasher
* Requires Java8 (but should be easy to port to older JREs)
* Currently it would work only for pbkdf2_sha256 algorithm
*
* Django code: https://github.com/django/django/blob/1.6.5/django/contrib/auth/hashers.py#L221
*/
import java.nio.charset.Charset;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
@mustafaturan
mustafaturan / latest-ffmpeg-centos6.sh
Last active October 25, 2022 20:14
Installs latest ffmpeg on Centos 6
# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
@destan
destan / text2png.py
Last active January 10, 2024 06:32
Python text to image (png) conversion with automatic new line calculation
# coding=utf8
import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
def text2png(text, fullpath, color = "#000", bgcolor = "#FFF", fontfullpath = None, fontsize = 13, leftpadding = 3, rightpadding = 3, width = 200):
REPLACEMENT_CHARACTER = u'\uFFFD'
NEWLINE_REPLACEMENT_STRING = ' ' + REPLACEMENT_CHARACTER + ' '