Skip to content

Instantly share code, notes, and snippets.

@kracekumar
kracekumar / mts_to_mp4.py
Created October 22, 2012 05:42
convert mts files to mp4
#! /usr/bin/env python
import sys
import os
#import gevent
def convert_to_mp4(path, new_filename, old_filename):
threads = 4
os.chdir(path)
@kanwarujjaval
kanwarujjaval / form.ejs
Created February 23, 2014 13:54
Creating multiple forms with a single ejs file in node.js
<form action="<%= action %>" method="post">
<% if (fields.length) { %>
<% fields.forEach(function(field){ %>
<label><%= field.name %></label>
<input type="<%= field.type %>" name="<%= field.name %>" <% if (field.property) { %> <%= field.property %> <% } %> >
<% }) %>
<% } %>
<button type="submit"><%= title %></button> <!--Title for button is same as that of the page-->
@lukaszmargielewski
lukaszmargielewski / gist:0a3b16d4661dd7d7e00d
Last active March 11, 2021 15:04
iOS Metal client side code for compute pipeline
// For stackoverflow question:
// http://stackoverflow.com/questions/30445801/ios8-metal-compute-pipeline-slower-than-cpu
// I. CODE INVOKED ONCE, AT THE INIT STAGE:
_mtlCharTable = [_mtlDevice newBufferWithBytes:_charTable->pointer length:_charTable->bytesTotal options:0];
_mtlSearchMasks = [_mtlDevice newBufferWithBytesNoCopy:_searchIndexes.mask length:_searchIndexes.bytesTotalMask options:0 deallocator:nil];
//iPhone 6: maxTotalThreadsPerThreadgroup: 512, threadExecutionWidth: 32
uint threadsPerThreadGroup = [_mtlComputePipelineState maxTotalThreadsPerThreadgroup];// / 4.0;
@spencermefford
spencermefford / 0-model-override.js
Created July 28, 2015 02:51
An alternative to extending Loopback's built in models. In our application, we wanted to create a custom role called "ecm-administrator" that would have the ability to create and manage users.
module.exports = function (app) {
var _ = require('lodash');
var User = app.models.User;
var Role = app.models.Role;
var RoleMapping = app.models.RoleMapping;
var ACL = app.models.ACL;
/*
* Configure ACL's
*/
@graphitemaster
graphitemaster / T0.md
Last active May 6, 2024 10:18
Vulkan Tutorial

Tutorial 0

What is Vulkan

Vulkan is a low-overhead, cross-platform 3D graphics and compute API.

Vulkan targets

Vulkan targets high-performance realtime 3D graphics applications such as games and interactive media across multiple platforms providing higher performance and lower CPU usage.

@p10rahulm
p10rahulm / create_static_site.MD
Last active June 21, 2024 19:53
Create Static Site using Godaddy and Google Cloud Storage in 15 minutes

Steps to create a static Site using Godaddy and Google Cloud Storage

Create a static html site

  • Can use this boilerplate to modify: http://www.initializr.com/
  • Make all your subpages and make sure to link them
  • Check your index.html works
@j-j-m
j-j-m / commonprofile.metal
Created May 8, 2017 00:20
Can't access GL Uniforms in Metal shader modifier? Apple docs for SCNShadable written in terms of GL? Pulling your hair out?... this will help.
////////////////////////////////////////////////
// CommonProfile Shader v2
#import <metal_stdlib>
using namespace metal;
#ifndef __SCNMetalDefines__
#define __SCNMetalDefines__
@seraku24
seraku24 / 149909-playlist_youtube-vlc3patch.lua
Created May 16, 2018 09:56
VLC 3.x compatibility patch for 149909-playlist_youtube.lua
--[[
Youtube playlist importer for VLC media player 1.1 and 2.0
Copyright 2012 Guillaume Le Maout
Authors: Guillaume Le Maout
Contact: http://addons.videolan.org/messages/?action=newmessage&username=exebetche
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@Mahedi-61
Mahedi-61 / cuda_11.8_installation_on_Ubuntu_22.04
Last active July 21, 2024 12:41
Instructions for CUDA v11.8 and cuDNN 8.9.7 installation on Ubuntu 22.04 for PyTorch 2.1.2
#!/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