Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Alexander J. Rodriguez D. AlexR1712

🏠
Working from home
Block or report user

Report or block AlexR1712

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MrJmpl3
MrJmpl3 / ApiTrait.php
Last active Jul 18, 2019
ApiTrait - Trait helpers to Laravel API Resources
View ApiTrait.php
<?php
/**
* Copyright (c) 2018.
* Archivo desarrollado por Jose Manuel Casani Guerra bajo el pseudonimo de MrJmpl3
*
* Email: jmpl3.soporte@gmail.com
* Twitter: @MrJmpl3
* Pagina Web: https://mrjmpl3-official.es
*/
@xen
xen / check_hash.py
Last active Jul 21, 2019
telegram site auth
View check_hash.py
# implementation of Telegram site authorization checking algorithm
# for more information https://core.telegram.org/widgets/login#checking-authorization
import collections
import hmac
import hashlib
def check_string(d, token):
secret = hashlib.sha256()
secret.update(token.encode('utf-8'))
View check_authorization.php
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@AlexR1712
AlexR1712 / bancos
Created Dec 27, 2017 — forked from xombra/bancos
Codigo y Bancos correspondientes de Venezuela
View bancos
Banco:
<select name="banco">
<option value=""></option>
<option value="0156">100%BANCO</option>
<option value="0196">ABN AMRO BANK</option>
<option value="0172">BANCAMIGA BANCO MICROFINANCIERO, C.A.</option>
<option value="0171">BANCO ACTIVO BANCO COMERCIAL, C.A.</option>
<option value="0166">BANCO AGRICOLA</option>
<option value="0175">BANCO BICENTENARIO</option>
<option value="0128">BANCO CARONI, C.A. BANCO UNIVERSAL</option>
@peterbrinck
peterbrinck / Laravel on VestaCP.md
Last active Aug 10, 2019
Laravel web templates for VestaCP
View Laravel on VestaCP.md

I'm not using this or VestaCP anymore, so I can't confirm if still working or not.

I've made a new web template to make Laravel work easily on VestaCP, and so I wouldn't have to change my Laravel installation, if I ever wanted to deploy it elsewhere.

Each file should be put in /usr/local/vesta/data/templates/web/apache2

Then, when you edit your domain/site, you can change the web template to Laravel and just upload your whole project into public_html

View auth.service.ts
import { Injectable } from '@angular/core';
import { Http, Response, Headers } from '@angular/http';
import * as jwt_decode from 'jwt-decode';
export const TOKEN_NAME: string = 'jwt_token';
@Injectable()
export class AuthService {
private url: string = 'api/auth';
View zero-downtime.sh
# stop script on error signal
set -e
# remove old deployment folders
if [ -d "/home/forge/weather-deploy" ]; then
rm -R /home/forge/weather-deploy
fi
if [ -d "/home/forge/weather-backup" ]; then
rm -R /home/forge/weather-backup
fi
View commonCharacterCount.js
function commonCharacterCount(s1, s2) {
var string1=s1.split('');
var string2=s2.split('');
var common=0;
for(var i=0;i<string1.length;i++){
if(string2.indexOf(string1[i])>=0){
common++;
string2.splice(string2.indexOf(string1[i]),1);
}
@Kovah
Kovah / mysql-levenshtein.sql
Created Feb 22, 2017
Levenshtein function for MySQL
View mysql-levenshtein.sql
-- Levenshtein function
-- Source: https://openquery.com.au/blog/levenshtein-mysql-stored-function
-- Levenshtein reference: http://en.wikipedia.org/wiki/Levenshtein_distance
-- Arjen note: because the levenshtein value is encoded in a byte array, distance cannot exceed 255;
-- thus the maximum string length this implementation can handle is also limited to 255 characters.
DELIMITER $$
DROP FUNCTION IF EXISTS LEVENSHTEIN $$
CREATE FUNCTION LEVENSHTEIN(s1 VARCHAR(255) CHARACTER SET utf8, s2 VARCHAR(255) CHARACTER SET utf8)
@barbietunnie
barbietunnie / udemy-courses-download-using-cookies.md
Last active Aug 17, 2019
Downloading Udemy videos with youtube-dl
View udemy-courses-download-using-cookies.md

How to download your Udemy course videos using youtube-dl

$ youtube-dl --list-extractors | grep udemy

Steps

  1. Get link to the course to download. e.g. https://www.udemy.com/course-name/
  2. Login into udemy website, save the cookie from chrome using Chrome (Cookie.txt)[1] export extension. Save it to file udemy-cookies.txt
  3. Get the link of the video that you want to download. usually in format. Use the command provided below where you have to replace the {course_link} and {path_to_cookies_file} with respective paths.
$ youtube-dl {course_link} --cookies {path_to_cookies_file}
You can’t perform that action at this time.