Skip to content

Instantly share code, notes, and snippets.

View m2sh's full-sized avatar
🤔
hmm!

Mohammad Shahgolzadeh m2sh

🤔
hmm!
View GitHub Profile
@carlj
carlj / rsa-encryption.md
Last active February 28, 2020 07:01
RSA large File En- and Decryption

RSA File De- and Encryption

Docu for encrypt and decrypt a large file with AES and RSA

Keypairs

Generate RSA Keypairs

//generates a private Key with 8196 Bit. 
openssl genrsa -out private.pem 8196
@jaivikram
jaivikram / getVideoDetails.py
Last active April 18, 2020 13:02
Python gist to obtain video details like duration, resolution, bitrate, video codec and audio codec, frequency using 'ffmpeg'
#! /usr/bin/env python
import os
import sys
import re
import tempfile
def getVideoDetails(filepath):
tmpf = tempfile.NamedTemporaryFile()
os.system("ffmpeg -i \"%s\" 2> %s" % (filepath, tmpf.name))
lines = tmpf.readlines()
@jsphpl
jsphpl / NPerGroup.php
Last active May 26, 2020 06:09 — forked from tureki/BaseModel.php
laravel-pgsql-n-related-models-per-parent-with-scopes
<?php
namespace App\Models\Traits;
use DB;
/**
* This trait is to work around a problem where a limit on an Eloquent
* relation by default applies to all queried models in total.
*
@arastu
arastu / current_track.applescript
Last active November 27, 2020 19:52
update twitter bio and add current playing song from Spotify to it
on escape_quotes(string_to_escape)
set AppleScript's text item delimiters to the "\""
set the item_list to every text item of string_to_escape
set AppleScript's text item delimiters to the "\\\""
set string_to_escape to the item_list as string
set AppleScript's text item delimiters to ""
return string_to_escape
end escape_quotes
tell application "Spotify"
/**
* Open https://app.snapp.ir
* Login with your credentials
* Copy and pasting this code in developer tools console
* Waiting... :)
*/
(async function () {
function sleep(ms = 0) {
return new Promise(r => setTimeout(r, ms));
}
@mardix
mardix / php-cs-fixer-pre-commit.php
Created September 4, 2012 17:06
A pre-commit hook to make PHP code PSR-2 compliant, check for syntax error
#!/usr/bin/php
<?php
/**
* .git/hooks/pre-commit
*
* This pre-commit hooks will check for PHP error (lint), and make sure the code
* is PSR compliant.
*
* Dependecy: PHP-CS-Fixer (https://github.com/fabpot/PHP-CS-Fixer)
*
import EventEmitter from "events";
let priv = new WeakMap();
let simulatorCoords = [
[40.678178, -73.944158],
[40.678181, -73.943267],
[40.678083, -73.941593],
[40.678034, -73.940649],
];
let index = 0;
@jugyo
jugyo / nginx.conf
Created September 27, 2012 09:02
nginx.conf to switch proxy for mobile
http {
upstream app-pc {
server 127.0.0.1:8001;
}
upstream app-mobile {
server 127.0.0.1:8002;
}
server {
@Thermionix
Thermionix / auth-basic.conf
Last active November 4, 2021 00:56
nginx reverse proxy for sickbeard, couchpotato etc.
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd;
@urish
urish / neopixel.ino
Last active November 6, 2021 20:16
Simple NeoPixel Animation for Arduino on WeMos D1 Mini, License: MIT
#include <Adafruit_NeoPixel.h>
#define NUM_PIXELS 24
Adafruit_NeoPixel pixels(NUM_PIXELS, D2, NEO_GRB | NEO_KHZ800);
void setup() {
pixels.begin();
}