This file contains 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
{ | |
"glossary": { | |
"title": "example glossary", | |
"GlossDiv": { | |
"title": "S", | |
"GlossList": { | |
"GlossEntry": { | |
"ID": "SGML", | |
"SortAs": "SGML", | |
"GlossTerm": "Standard Generalized Markup Language", |
This file contains 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
#!/usr/local/bin/bash | |
# Example usage -- compile https://gist.github.com/stephan-buckmaster/fd4662953d48737f7d592eeb772e76f1 under Linux system, obtain a.out | |
# Run $ compat-demo.sh a.out 'ABC DEF' 123 | |
# a.out will have MY_LINUX_LIB_PATH set as follows | |
export MY_LINUX_LIB_PATH=/a/b/c/12/34 | |
exec "$@" # Don't know how to do this in csh/tcsh -- allows treating arguments containing spaces as expected |
This file contains 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
#include "stdio.h" | |
int main(int argc, char **argv, char **envp) | |
{ | |
printf("Environment:\n"); | |
for (char **env = envp; *env != 0; env++) | |
{ | |
char *thisEnv = *env; | |
printf("%s\n", thisEnv); | |
} |
This file contains 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
module GetConstNames | |
def my_const_names | |
Module.constants.select { |c| Module.const_get(c).object_id == self.object_id} | |
end | |
end | |
class ABC | |
include GetConstNames | |
end |
This file contains 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
im1 = imread('im1.png'); | |
im2 = imread('im2.png'); | |
imshow([im1 im2]) | |
%% | |
im1 = im2double(im1); | |
im1_gray = rgb2gray(im1); | |
im2 = im2double(im2); | |
im2_gray = rgb2gray(im2); | |
%% |
This file contains 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
# Couple of bash extensions. Place at end of ~/.bashrc | |
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
# don't put duplicate lines in the history. | |
export HISTCONTROL=ignoredups | |
# ... and ignore same sucessive entries. | |
export HISTSIZE=5000 |
This file contains 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
#!/usr/bin/ruby | |
# Collapses Gettext po files. for easy diff'ing | |
# Drops comments, and collapses quotes into one line. | |
# Example of what a po-file is: https://docs.transifex.com/formats/gettext | |
# Expanding the script by Raphaël Kolm at https://medium.com/@rkz_io/making-a-clutter-free-git-diff-on-gettext-translation-files-9c0c1bb1d8aa | |
# Sample output: | |
# 00001 msgid "is english def" | |
# 00001 msgstr "est anglais" | |
# 00002 msgid "good" |
This file contains 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 | |
# | |
# if changed assets are being committed, prompt the user to confirm | |
# they have precompiled assets. | |
if test $(git diff --cached --name-only | grep app/assets | wc -l) != 0 | |
then | |
# grab user input | |
exec < /dev/tty |
This file contains 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
# a ruby script | |
get_database_list_command = "mysql -u root -p -e 'show databases' | grep -v Database | grep -v 'information' | grep -v 'mysql'" | |
database_names = ` #{get_database_list_command} `.split(/\n/) | |
drop_databases_sql_statements = database_names.collect { |db| "drop database if exists `#{db}`;" if db.length > 0}.compact.join(' ') | |
puts 'Executing drop commands:' | |
puts drop_databases_sql_statements | |
puts drop_databases_sql_statements.split(/;/).join(";\n") |
This file contains 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
<!DOCTYPE html> | |
<html data-nav-highlight-class-name="highlight-global-nav-home"> | |
<head> | |
<title>Twitter</title> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta charset="utf-8" /> | |
NewerOlder