Skip to content

Instantly share code, notes, and snippets.

View xikaos's full-sized avatar

Francisco Budaszewski Zanatta xikaos

  • Tiny ERP by Olist
  • Brazil
  • 07:44 (UTC -03:00)
View GitHub Profile
@pietro-rutzen
pietro-rutzen / scheduleToggle.js
Created June 19, 2020 02:01
Javascript útil para lidar com páginas de programação de eventos
<script>
const arrayDays = []
for (let i = {{ firstDay }}; i <= {{ lastDay }}; i++) {
arrayDays.push(i);
}
let arrayIndex = 0;
$('.up-arrow').click(function(){
if (arrayIndex === 0) {
arrayIndex = arrayDays.length-1
} else {
@jamesmacwhite
jamesmacwhite / ffmpeg_mkv_mp4_conversion.md
Last active April 11, 2024 22:29
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example

@cure53
cure53 / scriptlet.md
Last active February 1, 2024 19:33
The Scriptless Scriptlet - Or how to execute JavaScript from CSS in MSIE11 without using Scripts

The Scriptless Scriptlet

Or how to execute JavaScript from CSS in MSIE11 without using Scripts

Stop! This text is only interesting for you if you...

  • Like popping alerts in weird situations
  • Miss CSS expressions as much as we do
  • Have an unhealthy obsession for markup porn

Introduction

from flask import Flask, render_template, request
import os , shelve , atexit , threading , urllib2 , time
app = Flask(__name__)
poll_data = {
'question' : 'You agree that the Brazilian internet should be stapled?',
'fields': ['Yes', 'No']
}
db = shelve.open("votes.db",writeback=True)
pfSsh.php playback disablereferercheck
@fyrebase
fyrebase / guide.md
Created December 2, 2015 10:02
Setup individual pools for PHP-FPM and NGINX - http://www.binarytides.com/php-fpm-separate-user-uid-linux/

Php-FPM

Php fpm is the new way to setup php to run with your webserver. Php-fpm is a fastcgi process manager for php that is totally separate from the webserver. The webserver communicates with fpm through a socket and passes the name of the script to execute. So fpm can run with any web server that is fastcgi compatible.

I recently moved from my old shared hosting to linode. Linode provides linux vps hosting at economic prices. However the servers are totally unmanaged are just raw linux machines that have shell access. So through the shell you have to setup everything including the web server, php and the web files.

So this time I decided to go with the combination of nginx and php-fpm. I had multiple sites to setup on this new webserver. Nginx deals with these through separate server blocks (aka vhost in apache). However there was another thing needed. Php on each site should run with its own user and not the nginx common user named www-data.

Running each site with its own uid/gid is more secure and

@obfusk
obfusk / break.py
Last active May 1, 2024 20:32
python "breakpoint" (more or less equivalent to ruby's binding.pry); for a proper debugger, use https://docs.python.org/3/library/pdb.html
import code; code.interact(local=dict(globals(), **locals()))
@neilcarpenter
neilcarpenter / gist:8979ea9ed91b10e36af9
Created March 5, 2015 11:03
Enable Emmet in .JSX files, using Babel JSX Syntax highlighter
// add to Preferences > Key Bindings - User
// see http://stackoverflow.com/a/26619524 for context
{ "keys": ["tab"], "command": "expand_abbreviation_by_tab",
"context": [
{
"operand": "source.js",
"operator": "equal",
"match_all": true,
"key": "selector"
#!/bin/sed -rf
# How to run:
# echo 'A A<1+B1-C>B<1-A1+B>D<1-B1qC> 0<0>0'
# Note: Your local sed may use a different flag for "extended" regexes; this is written for GNU sed.
#
# tape: [active-state] " " (state-name "<" (write move next-state)_0 (write move next-state)_1 ">")* " " tape... "<" curpos ">" tape...
# State names can be any character not in " <>".
# The tape consists of 0's and 1's.
# The "move" field can be "-" to move left, "+" to move right, or "q" to halt.