Skip to content

Instantly share code, notes, and snippets.

View Partoo's full-sized avatar
💭
I may be slow to respond.

Partoo Partoo

💭
I may be slow to respond.
View GitHub Profile
import os
import numpy as np
import platform
import subprocess
import wave
import torch
from ChatTTS import Chat
import argparse
@Partoo
Partoo / cuda_11.8_installation_on_Ubuntu_22.04
Created September 11, 2023 12:31 — forked from MihailCosmin/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v11.8 and cuDNN 8.7 installation on Ubuntu 22.04 for PyTorch 2.0.0
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@Partoo
Partoo / default
Created August 8, 2023 14:07 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@Partoo
Partoo / filterArray.js
Created June 9, 2020 05:38 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@Partoo
Partoo / utils.js
Last active July 30, 2022 14:03
Useful JS snippets
// guid-> 9b06304f-e10f-4363-8257-eca66e58e559
export default function guid() {
let s = [];
let hexDigits = '0123456789abcdef';
for (var i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[14] = '4'; // bits 12-15 of the time_hi_and_version field to 0010
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
s[8] = s[13] = s[18] = s[23] = '-';
@Partoo
Partoo / cuda_installation_on_ubuntu_18.04
Last active February 10, 2019 02:12 — forked from Brainiarc7/cuda_installation_on_ubuntu_18.04
cuda 9.0 installation guidline for ubuntu 18.04 LTS
# first get the PPA repository driver
sudo add-apt-repository ppa:graphics-drivers/ppa
# install nvidai driver
sudo apt install nvidia-384 nvidia-384-dev
# install other import packages
sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
# CUDA 9 requires gcc 6
@Partoo
Partoo / re.py
Created December 2, 2018 07:15 — forked from dervn/re.py
Python中过滤HTML标签的函数
#用正则简单过滤html的<>标签
import re
str = "<img /><a>srcd</a>hello</br><br/>"
str = re.sub(r'</?\w+[^>]*>','',str)
print str
@Partoo
Partoo / install.sh
Last active July 8, 2018 11:12 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=2.40
echo "LC_ALL=en_US.UTF-8" >> /etc/environment
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
locale-gen en_US.UTF-8
https://github.com/tianon/docker-brew-debian/issues/45
Route::group(array('prefix' => 'api'), function()
{
Route::resource('cities', 'CitiesAPIController');
});
Route::filter('manage-city', function(){
if (! Entrust::can('edit-city') && $_SERVER['REQUEST_METHOD']!='GET') // Checks the current user
{
$API= new Twiddle\Http\Controllers\ApiController();