This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #enter input encoding here | |
| FROM_ENCODING="ISO_8859-1" | |
| #output encoding(UTF-8) | |
| TO_ENCODING="UTF-8" | |
| #convert | |
| CONVERT="iconv -f $FROM_ENCODING -t $TO_ENCODING" | |
| #loop to convert multiple files | |
| for file in ./*.txt; do | |
| encoding=$(file -I "$file" | awk '{print $3}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git filter-branch --env-filter 'if [ "$GIT_AUTHOR_EMAIL" = "[email protected]" ]; then | |
| [email protected]; | |
| GIT_AUTHOR_NAME="New Name"; | |
| GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL; | |
| GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; fi' -- --all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main_test | |
| import ( | |
| "strings" | |
| "unicode" | |
| "testing" | |
| ) | |
| func SpaceMap(str string) string { | |
| return strings.Map(func(r rune) rune { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Flask related imports | |
| from flask import Flask, render_template, jsonify, abort, request, make_response, session, redirect, url_for | |
| # Flask extensions | |
| from flask.ext.mongoengine import MongoEngine | |
| from flask_debugtoolbar import DebugToolbarExtension | |
| # Flask blueprints | |
| import companies | |
| from companies.views import companies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Compiled source # | |
| ################### | |
| *.com | |
| *.class | |
| *.dll | |
| *.exe | |
| *.o | |
| *.so | |
| # Packages # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| frontend http-in | |
| mode http | |
| bind FRONTENDIP:80 | |
| default_backend nginx_server_1 | |
| acl nginx_1 hdr_end(host) -i www.xyz.com | |
| acl nginx_2 hdr_end(host) -i abc.xyz.com | |
| acl nginx_path path_beg /abc/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # send a fake log to log service | |
| echo "<150>`env LANG=us_US.UTF-8 date "+%b %d %H:%M:%S"` host`date +%s` service: my special message goes here" | nc 192.168.0.1 -u 514 -w 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def smart_group_by_nearest(distance, int_list): | |
| int_list.sort() | |
| grouped_list = [[int_list[0]]] | |
| for x in int_list[1:]: | |
| if x - grouped_list[-1][0] <= distance: | |
| grouped_list[-1].append(x) | |
| else: | |
| grouped_list.append([x]) | |
| return grouped_list | |
| #remove small groups if wanted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # DUBSTEP | |
| # Combines ideas from my other gists | |
| current_bpm = 140.0 | |
| use_bpm current_bpm | |
| # WOBBLE BASS | |
| define :wob do | |
| use_synth :dsaw | |
| lowcut = note(:E1) # ~ 40Hz | |
| highcut = note(:G8) # ~ 3000Hz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function cprint_r($var, $json = false) | |
| { | |
| $output = "<script type='text/javascript'>"; | |
| if (is_object($var)) { | |
| $mirror = new \ReflectionClass($var); | |
| $var = $mirror->getProperties(); | |
| } elseif (is_array($var)) { |