Skip to content

Instantly share code, notes, and snippets.

View StefanYohansson's full-sized avatar
🖤
λ

snotr StefanYohansson

🖤
λ
  • Porto - Portugal
  • 16:07 (UTC +01:00)
View GitHub Profile
@StefanYohansson
StefanYohansson / Csv2Arr
Last active December 16, 2017 15:39
uma classe para transformar csv em array
<?php
class Csv2arr
{
public $csv;
public $separador;
public $tamanho;
@StefanYohansson
StefanYohansson / cdr_extractor.py
Last active August 29, 2015 14:21
freeswitch-hep-logger.sh
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import sys
import json
class CdrExtractor:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
" set number " turn on line numbers and highlight colors
set ruler " Always show current positions along the bottom
set showcmd " show the command being typed
set autoindent " autoindent spaces
set cursorline
set nocursorcolumn
set nocursorline
set laststatus=2
syntax sync minlines=256
var $ = jQuery;
function removeEls() {
$('.reviewers').remove();
$('.count-column-value').remove();
$('.aui-iconfont-devtools-arrow-right').remove();
$('.pull-request-target-branch').remove();
$('.avatar-with-name').remove();
$('.build-status-pr-list-col-value').remove();
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- copy/paste of flat-ui.css -->
<style>
[class^="fui-"],
[class*="fui-"] {
font-family: 'Flat-UI-Icons';
speak: none;
@StefanYohansson
StefanYohansson / mysql_backup.sh
Last active November 7, 2016 14:02
backup scripts
#!/bin/sh
function send_backup {
rsync -r -z -c $1 root@server.com:/backups
if [ "$?" -eq "0" ]
then
rm -rf $1
echo "Rsync success." > $logfile_path/db_log.log
else
echo "Rsync fail." > $logfile_path/db_log.log
@StefanYohansson
StefanYohansson / fipe2json.js
Created November 28, 2016 14:13
exportar tabela Fipe
var marcas = $('#selectMarcacarro option');
var modelos = [];
var modelos_ano = {};
var marcas_list = {};
marcas.each((i,e) => {
if (e.value != '')
marcas_list[e.value] = {
name: $(e).html(),
modelos: {}
@StefanYohansson
StefanYohansson / debug.md
Created March 17, 2017 13:25
debug from atom-beautify on run beautysh
From c0dcef7d7510c2624d67f88eaf7e6b43e277fbd1 Mon Sep 17 00:00:00 2001
From: StefanYohansson <sy.fen0@gmail.com>
Date: Wed, 29 Mar 2017 20:54:08 -0300
Subject: [PATCH] Added Hatsune Miku theme.
Hatsune Miku from Vocaloid Project.
---
data/CMakeLists.txt | 1 +
data/hatsunerc | 135 ++++++++++++++++++++++++++++++
data/pics/animated/CMakeLists.txt | 2 +-
@StefanYohansson
StefanYohansson / batterylife.sh
Created October 25, 2017 14:09
Battery life script to warn when battery is under 40% and above 80%
#!/bin/bash
MIN=40
MAX=80
while true ; do
unplugged=$(cat /sys/bus/acpi/drivers/battery/*/power_supply/BAT?/status|grep -i discharging)
acpiout=$(acpi)
if [ "$(echo $acpiout|grep -Po "[0-9]+(?=%)")" -le $MIN ]; then #Battery under low limit
if [ ! "$unplugged" == "" ]; then #unplugged