Skip to content

Instantly share code, notes, and snippets.

View milosb793's full-sized avatar

milosb793

  • At the Cloud
View GitHub Profile
@justjkk
justjkk / camel2Title.php
Created November 28, 2011 21:06
CamelCase to Title Case PHP Regex
<?php
function camelToTitle($camelStr)
{
$intermediate = preg_replace('/(?!^)([[:upper:]][[:lower:]]+)/',
' $0',
$camelStr);
$titleStr = preg_replace('/(?!^)([[:lower:]])([[:upper:]])/',
'$1 $2',
$intermediate);
@johanhdm
johanhdm / gist:2224747
Created March 28, 2012 08:30
JSON stringify associative array returns empty array - use {} instead of new Array()
//JSON.stringify an associative array using the Array object --> does not work
var array1 = new Array();
array1['a'] = { x : 1, y : 2 };
console.log(array1);
//outputs : [ a: { x: 1, y: 2 } ]
console.log(JSON.stringify(array1));
//outputs : []
@digitaljhelms
digitaljhelms / gist:4287848
Last active July 19, 2024 03:32
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
# ROUTER
GWS.Router.map (match) ->
#match("/").to("home") # home.handlebars gets rendered automatically and mapped to /
# according to guide the previous logic shouldn't be needed. but it won't work without it
# you can either use model: () -> or
# setupController: (controller, model) ->
# controller.set 'content', model
@hezhao
hezhao / myapp.conf
Last active May 20, 2022 05:34
Example supervisor config file /etc/supervisor/conf.d/myapp.conf
[program:myapp]
autostart = true
autorestart = true
command = python /home/pi/myapp.py
environment=HOME="/home/pi",USER="pi",SECRET_ID="secret_id",SECRET_KEY="secret_key_avoiding_%_chars"
stdout_logfile = /home/pi/stdout.log
stderr_logfile = /home/pi/stderr.log
startretries = 3
user = pi
@jaxbot
jaxbot / gist:5748513
Created June 10, 2013 12:58
Block nginx from serving .git directories
location ~ /\.git {
deny all;
}
# or, all . directories/files in general (including .htaccess, etc)
location ~ /\. {
deny all;
}
@cmartinbaughman
cmartinbaughman / GoogleHackMasterList.txt
Last active July 6, 2024 23:16
The definitive super list for "Google Hacking".
admin account info" filetype:log
!Host=*.* intext:enc_UserPassword=* ext:pcf
"# -FrontPage-" ext:pwd inurl:(service | authors | administrators | users) "# -FrontPage-" inurl:service.pwd
"AutoCreate=TRUE password=*"
"http://*:*@www&#8221; domainname
"index of/" "ws_ftp.ini" "parent directory"
"liveice configuration file" ext:cfg -site:sourceforge.net
"parent directory" +proftpdpasswd
Duclassified" -site:duware.com "DUware All Rights reserved"
duclassmate" -site:duware.com
@oldcai
oldcai / compression_benchmark.py
Last active March 30, 2024 13:11
zlib vs lz4 vs lzma vs zstd compression
import time
import requests
import zlib
#!pip install lz4 pylzma zstd
import lz4.block
import pylzma as lzma
import zstd
def measure_time_and_compress_decompress(compress_func, decompress_func, data, *args):
# Measure compression time
@n0531m
n0531m / list_gcp_iprange.sh
Last active July 11, 2024 19:34
Google Cloud Platform : ip address range
#!/bin/bash
# https://cloud.google.com/compute/docs/faq#find_ip_range
# nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8
myarray=()
for LINE in `dig txt _cloud-netblocks.googleusercontent.com +short | tr " " "\n" | grep include | cut -f 2 -d :`
do
myarray+=($LINE)
for LINE2 in `dig txt $LINE +short | tr " " "\n" | grep include | cut -f 2 -d :`
@mabasic
mabasic / helpers.php
Last active May 10, 2024 19:25
config_path function for Lumen framework
<?php
if ( ! function_exists('config_path'))
{
/**
* Get the configuration path.
*
* @param string $path
* @return string
*/